[英]Django: python3 manage.py migrate ModuleNotFoundError: No module named 'django'
i'm a total noob in django so go easy on me.. i tried to run these commands on ubuntu terminal and gave me the same error 我在django中是个菜鸟,所以对我好一点..我试图在ubuntu终端上运行这些命令,并给了我同样的错误
python3 manage.py migrate
python manage.py makemigrations MyAppName
python manage.py migrate
python manage.py syncdb --all
error message: 错误信息:
Traceback (most recent call last):
File "manage.py", line 8, in <module>
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 "manage.py", line 14, in <module>
) from exc
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?
and i was told that i should never edit manage.py 有人告诉我,我永远不要编辑manage.py
update: i manged to run the project and made some modifications on it. 更新:我管理运行该项目并对其进行了一些修改。
尚未安装Django,请使用以下命令进行安装:
pip install django
Just do a check of all modules installed using command - pip list 只需检查使用命令安装的所有模块- 点列表
If it does not show django in the list of modules install it using - pip install django 如果在模块列表中未显示django,请使用-pip install django进行安装
If it shows django in the list then the version of django installed may not be compatible with the version of python you are using. 如果在列表中显示django,则安装的django版本可能与您使用的python版本不兼容。 You can try installing a compatible version of django.
您可以尝试安装兼容版本的django。
Also, you can create a virtual environment and install django inside the environment. 另外,您可以创建一个虚拟环境并在该环境中安装django。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.