简体   繁体   English

我尝试使用 pip install django 安装 django 但我仍然收到此错误任何评论

[英]I tried to install django using pip install django but still i am getting this error any comments

from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django'从 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\emin\Desktop\fliteplan\gen_angular\arinc_424_19_db\multi\src\manage.py", line 22, in main() File "C:\Users\emin\Desktop\fliteplan\gen_angular\arinc_424_19_db\multi\src\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?回溯(最后一次调用):文件“C:\Users\emin\Desktop\fliteplan\gen_angular\arinc_424_19_db\multi\src\manage.py”,第 22 行,在 main() 文件“C:\Users\emin\ Desktop\fliteplan\gen_angular\arinc_424_19_db\multi\src\manage.py",第 13 行,主要引发 ImportError(ImportError:无法导入 Django。您确定它已安装并在您的 PYTHONPATH 环境变量中可用吗?您是否忘记激活虚拟环境?

Make sure to have a virtual environment whenever saving new dependencies, most importantly django.确保在保存新依赖项时有一个虚拟环境,最重要的是 django。

virtualenv env
source env/bin/activate

pip install django

// save the dependency
pip freeze > requirements.txt

* Note the syntax, virtualenv [env name] env can be any name but you would still activate it from [env name]/bin/activate *请注意语法,virtualenv [env name] env 可以是任何名称,但您仍然可以从 [env name]/bin/activate 激活它

Did you active your virtual environment?您是否激活了虚拟环境? If didn't then you can follow this solution to do that here is the link如果没有,那么您可以按照此解决方案执行此操作, 这是链接

And if still unable to install Django then check your python installation.如果仍然无法安装 Django 然后检查您的 python 安装。 if python is working perfectly then try如果 python 工作正常,然后尝试

python -m pip install django

and according to your os, you can follow this official documentation link official documentation of Django to install根据您的操作系统,您可以按照Django 的官方文档链接进行安装

Thanks谢谢

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM