为了账号安全,请及时绑定邮箱和手机立即绑定

在PyCharm终端中执行python manage.py runserver报错: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'

D:\DjangoProject\django_introduction>python manage.py runserver

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?


正在回答

3 回答

运行了,还是不行,删除了除conda意外的python,避免了冲突问题,也还是不行

0 回复 有任何疑惑可以回复我~

'conda' 不是内部或外部命令,也不是可运行的程序

或批处理文件。

?

0 回复 有任何疑惑可以回复我~

原来在DOS环境下需要先执行:  conda activate命令,然后再执行 python manage.py runserver就可以了。

如下:

D:\DjangoProject\django_introduction>conda activate


(base) D:\DjangoProject\django_introduction>python manage.py runserver

Performing system checks...


System check identified no issues (0 silenced).


You have 15 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.

Run 'python manage.py migrate' to apply them.

April 08, 2020 - 11:39:34

Django version 2.1, using settings 'django_introduction.settings'

Starting development server at http://127.0.0.1:8000/

Quit the server with CTRL-BREAK.


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

在PyCharm终端中执行python manage.py runserver报错: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'

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信