简体   繁体   English

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

[英]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.

相关问题 运行 Django 的“python3 manage.py migrate”时“No module named &#39;_sqlite3&#39;” - “No module named '_sqlite3'” when running Django's “python3 manage.py migrate” python3 django manage.py迁移错误_gorg - python3 django manage.py migrate error _gorg ModuleNotFoundError:在尝试 &gt;Python manage.py makemigrations|python 3.7、django 2.1.7 时没有名为“DEGNet”的模块 - ModuleNotFoundError: No module named 'DEGNet' while attempting >Python manage.py makemigrations|python 3.7, django 2.1.7 在 python3 manage.py 运行服务器中运行我的 django 项目时,我收到此错误 ModuleNotFoundError: No module named 'pip._vendor.urllib3.connection' - When running my django project in python3 manage.py run server i get this error ModuleNotFoundError: No module named 'pip._vendor.urllib3.connection' manage.py - 导入错误:没有名为 django 的模块 - manage.py - ImportError: No module named django Python manage.py ImportError:没有名为django的模块 - Python manage.py ImportError: No module named django Django python manage.py migrate - Django python manage.py migrate 适用于Django的python3 manage.py runserver - python3 manage.py runserver for Django python manage.py runserver 错误:ModuleNotFoundError:没有名为“settings”的模块 - python manage.py runserver error : ModuleNotFoundError: No module named 'settings' python manage.py migrate:没有名为“muypicky.base”的模块 - python manage.py migrate: No module named 'muypicky.base'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM