【发布时间】:2023-01-20 19:14:36
【问题描述】:
我想创建 django 项目,所以我配置了 virtualenv ,并且在使用此命令 python3 manage.py startapp Accounts 创建应用程序时安装了 django pipenv install django==4.0.1
我收到了这个错误。
(env) zakaria@ZAKARIA:/mnt/c/Users/ZAKARIA/Desktop/project$ python manage.py startapp Accounts
Traceback (most recent call last):
File "manage.py", line 11, in main
from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django.core'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 13, in main
raise ImportError(
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?
任何人都可以帮助解决这个问题吗?
【问题讨论】:
-
不是
pip install django=4.0.1吗?您可以使用pip list来检查已安装的包 -
它安装在我的包中
-
@vinkomlacic 要使用 pip 安装特定版本,您需要使用双等号。不过,我不确定
pipenv(以前从未使用过)。 -
@ChaddRobertson 是的,这是一个错字。编辑:
pip install django==4.0.1 -
@vinkomlacic 我总是以相同的方式使用 pipenv 并且一直在工作我不知道发生了什么