ModuleNotFoundError: No module named 'tempfile'

1,964 views
Skip to first unread message

Olalekan Alashe

unread,
Oct 5, 2021, 4:37:17 PM10/5/21
to Django users
Pls ,How can i fixed this error (ModuleNotFoundError: No module named 'tempfile').i wanted to install Django with this command "python -m pip installs Django" .....I have python 3.8,3.7.3.9 on my system.

Thank you.

Kasper Laudrup

unread,
Oct 5, 2021, 4:45:23 PM10/5/21
to django...@googlegroups.com
The tempfile module is part of the Python standard library:

https://docs.python.org/3/library/tempfile.html

I would guess you have somehow messed up your Python installation(s),
but without any further information it's really hard to help you.

How did you install three different Python versions and how do you
select which one to run?

Kind regards,

Kasper Laudrup
OpenPGP_0xE5D9CAC64AAA55EB.asc
OpenPGP_signature

Adeyemi Deji

unread,
Oct 6, 2021, 4:59:01 AM10/6/21
to django...@googlegroups.com
First of all, what text editor do you use, If not visual studio code I recommend you get that one and learn how to use it, then u can always set the python interpreter based on your choice. Secondly u need a virtual environment and you can get that with (python -m venv venv) then activate it by changing directory to the directory where the venv folder exist and do this (call venv/scripts/activate) after that you can start using pip to install libraries by using (pip install libraryName), some libraries require you to add into the installed app list in your django project settings.py file for example the tempfile. This should solve your problem. If not, there are great developers out there that will be willing to help you out.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2f69b7fb-67bf-db15-0585-639b1aac9911%40stacktrace.dk.

Kasper Laudrup

unread,
Oct 6, 2021, 5:56:42 AM10/6/21
to django...@googlegroups.com
I think you replied to the wrong post here, but anyway:

On 06/10/2021 10.57, Adeyemi Deji wrote:
> First of all, what text editor do you use, If not visual studio code I
> recommend you get that one and learn how to use it, then u can always
> set the python interpreter based on your choice.

I don't see how a text editor is relevant for the problem here. Sure,
some kind of Python IDE might help, but since the poster I assume you
wanted to reply to already mentioned having installed three different
Python versions I don't think there's any reason to make things more
complicated by starting to discuss editors/IDEs. Would be relevant to
know *how* these Python versions were installed since that very much
sounds like that could be the cause of the problem.

I use Emacs BTW. :-)

> Secondly u need a
> virtual environment and you can get that with (python -m venv venv) then
> activate it by changing directory to the directory where the venv folder
> exist and do this (call venv/scripts/activate) after that you can start
> using pip to install libraries by using (pip install libraryName), some
> libraries require you to add into the installed app list in your django
> project settings.py file for example the tempfile. This should solve
> your problem. If not, there are great developers out there that will be
> willing to help you out.
>

That's all true and great, but as I wrote, tempfile is part of the
Python standard library so no reason to look into pip or installed apps
in Django. It sounds much more like a problem with the Python
installation(s).

Thanks anyway and kind regards,

Kasper Laudrup
OpenPGP_0xE5D9CAC64AAA55EB.asc
OpenPGP_signature

Adeyemi Deji

unread,
Oct 6, 2021, 7:04:46 AM10/6/21
to django...@googlegroups.com
Oh, I didn't get that talk about tempfile but I do now, thanks. Since installation is the issue, y not delete and reinstall  python latest version

Virus-free. www.avast.com

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages