首页 > 解决方案 > ImportError:在创建数据库时无法导入 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?

标签: django

解决方案


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


推荐阅读