python manage.py runserver命令在cmd命令框中可以正確執(zhí)行,但是在pycharm的終端中運(yùn)行就失敗了!
(venv) E:\python\practise\django\django_instuction>python manage.py runserver
Traceback (most recent call last):
? File "manage.py", line 10, in main
? ? from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'
在window的cmd中執(zhí)行就是好的?
E:\python\practise\django\django_instuction>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
You have 17 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.
November 17, 2019 - 17:15:00
Django version 2.2.7, using settings 'django_instuction.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
2019-11-17
原因就是直接使用Python的安裝目錄,不要使用venv目錄下的python環(huán)境變量!