简体   繁体   English

Django 错误 - 无法导入 Django。 您确定它已安装并在您的 PYTHONPATH 环境变量中可用吗?

[英]Django Error - Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable?

When I first ran the server everything was fine and the project was running properly.当我第一次运行服务器时,一切都很好,项目运行正常。 But after few days when I ran the server again, it gave me an error但是几天后我再次运行服务器时,它给了我一个错误

Traceback (most recent call last): File "C:\Users\Admin\Desktop\Django Project\first\manage.py", line 11, in main from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\Admin\Desktop\Django Project\first\manage.py", line 22, in <module> main() File "C:\Users\Admin\Desktop\Django Project\first\manage.py", line 13, in main raise ImportError( ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?

To be specific, I'm on Windows 10, using VS Code as my IDE (I've not setup any virtual environment).具体来说,我在 Windows 10 上,使用 VS Code 作为我的 IDE(我没有设置任何虚拟环境)。 Django version installed - 3.2.9 Python version installed - 3.10.0 PIP version installed - 21.2.3 Django 版本已安装 - 3.2.9 Python 版本已安装 - 3.10.0 PIP 版本已安装 - 21.2.3

Here is a screenshot of my Environment Variables [这是我的环境变量的屏幕截图 [1

I don't know what the problem was.我不知道是什么问题。 Thanks to everyone for their suggestions.感谢大家的建议。 I deleted the project and created a new one and it worked.我删除了该项目并创建了一个新项目,并且它有效。 I hope I won't face any such issue while working on a big project!我希望我在做一个大项目时不会遇到任何这样的问题!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 “导入错误:无法导入 Django。您确定它已安装并在您的 PYTHONPATH 环境变量中可用吗?” 在自制软件上 - "ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable?" On homebrew Suddenly ImportError: Couldn't import Django。您确定它已安装并在您的 PYTHONPATH 环境变量中可用吗? - Suddenly ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? 导入错误:无法导入 Django。 您确定它已安装并在您的 PYTHONPATH 环境变量中可用吗? - ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? 无法导入 Django。 您确定它已安装并在您的 PYTHONPATH 环境变量中可用吗? --&gt; WSGI.PY 文件 - Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? --> WSGI.PY file 无法导入 Django。 您确定它已安装并在您的 PYTHONPATH 上可用吗 - Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH Heroku 部署失败:无法导入 Django。您确定已安装吗? - Heroku deploy failed: Couldn't import Django. Are you sure it's installed? ImportError: 无法导入 Django。 蟒蛇路径 - ImportError: Couldn't import Django. PYTHONPATH “导入错误:无法导入 Django。” 即使在 Virtualenv 中拥有 Django - “ImportError: Couldn't import Django.” even after having Django in Virtualenv “导入错误:无法导入 Django。” 即使在 Virtualenv 中安装 Django 之后 - “ImportError: Couldn't import Django.” even after installing Django within Virtualenv 导入错误:无法导入 Django ... 您是否忘记激活虚拟环境? - ImportError: Couldn't import Django ... Did you forget to activate a virtual environment?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM