Django安装和环境不再被识别

2024-10-03 23:23:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我刚刚在我正在进行的Django项目中运行了我的Django开发服务器,我得到了这个

(baseballwebenv) C:\DjangoProjects\BaseballWebsite\baseballweb>python manage.py runserver
Traceback (most recent call last):
  File "manage.py", line 8, in <module>
    from django.core.management import execute_from_command_line
  File "C:\Users\Nick\Anaconda3\envs\baseballwebenv\lib\site-packages\django\__init__.py", line 1, in <module>
    from django.utils.version import get_version
  File "C:\Users\Nick\Anaconda3\envs\baseballwebenv\lib\site-packages\django\utils\version.py", line 4, in <module>
    import subprocess
  File "c:\users\nick\anaconda3\Lib\subprocess.py", line 178, in <module>
    from _winapi import (CREATE_NEW_CONSOLE, CREATE_NEW_PROCESS_GROUP,
ImportError: cannot import name 'ABOVE_NORMAL_PRIORITY_CLASS'

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?

正如您通过runserver命令看到的,我在虚拟环境中。我最近升级了我所有的Anaconda软件包,认为所有东西都在虚拟环境中得到了保护。我怀疑这个问题与此有关,但我不确定。如何使我的项目重新启动并运行?如果有人想查看某些文件,我也可以添加这些文件


Tags: 项目djangoinfrompyimportmanageversion