繁体   English   中英

Django:python3 manage.py migration ModuleNotFoundError:没有名为“ django”的模块

[英]Django: python3 manage.py migrate ModuleNotFoundError: No module named 'django'

我在django中是个菜鸟,所以对我好一点..我试图在ubuntu终端上运行这些命令,并给了我同样的错误

python3 manage.py migrate
python manage.py makemigrations MyAppName
python manage.py migrate
python manage.py syncdb --all

错误信息:

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?

有人告诉我,我永远不要编辑manage.py

更新:我管理运行该项目并对其进行了一些修改。

尚未安装Django,请使用以下命令进行安装:

pip install django

只需检查使用命令安装的所有模块- 点列表

如果在模块列表中未显示django,请使用-pip install django进行安装

如果在列表中显示django,则安装的django版本可能与您使用的python版本不兼容。 您可以尝试安装兼容版本的django。

另外,您可以创建一个虚拟环境并在该环境中安装django。

暂无
暂无

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

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