ImportError:在创建数据库时无法导入Django

时间:2019-01-14 17:22:28

标签: django

我正在尝试使用Django创建数据库,但出现以下错误:

(myvenv) C:\Users\hp\djangogirls>myvenv\Scripts\activate

(myvenv) C:\Users\hp\djangogirls> python manage.py migrate
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?

2 个答案:

答案 0 :(得分:0)

输入pip list,如果在列表中没有看到 Django ,请输入pip install django

答案 1 :(得分:0)

执行pip install django安装任何软件包以替换软件包名称,以免出现软件包错误