【发布时间】:2020-12-06 04:28:22
【问题描述】:
我正在处理一个 Django 项目,这就是我尝试运行服务器时得到的结果。它曾经工作得很好,但我认为 virtualenv 缺少路径。我昨天安装了anaconda,并且在高级系统设置中更改了路径变量。如何将它们恢复为原始设置?总python新手在这里。请帮忙。
C:\Users\13157\django_project>python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 9, in main
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 20, in <module>
main()
File "manage.py", line 11, 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?
C:\Users\13157\django_project>
【问题讨论】:
-
如果它以前工作过,你应该已经有一个安装了 django 的环境。所以'你必须激活环境。您是否使用
$ virtualenv env创建了环境? This info 可能会有所帮助! -
我认为 anaconda 安装改变了路径变量,我很久以前就创建了这个 django 应用程序。我只是想知道如何再次添加django应用路径变量。
标签: python django anaconda virtualenv