在python3中运行我的django项目 manage.py 运行服务器时,我收到此错误ModuleNotFoundError:没有名为'pip._vendor.urllib3.connectio



运行python3 manage.py runserver后,我得到以下错误:

追踪(最近一次通话(:文件";manage.py";,第11行,主从django.core.management导入execute_from_command_line文件"/Users/luisedouardo/Practice/nova/nova_venv/lib/python3.8/site packages/django/core/management/init.py";,第12行,in从django.conf导入设置ImportError:无法从"django.conf"(未知位置(导入名称"settings">

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?
(nova_venv) Luiss-MacBook-Pro:novadjango luiseduardo$ pip install django
Traceback (most recent call last):
File "/Users/luiseduardo/Practice/nova/nova_venv/bin/pip", line 6, in <module>
from pip._internal import main
File "/Users/luiseduardo/Practice/nova/nova_venv/lib/python3.8/site-packages/pip/_internal/__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "/Users/luiseduardo/Practice/nova/nova_venv/lib/python3.8/site-packages/pip/_vendor/urllib3/__init__.py", line 7, in <module>
from .connectionpool import (
File "/Users/luiseduardo/Practice/nova/nova_venv/lib/python3.8/site-packages/pip/_vendor/urllib3/connectionpool.py", line 30, in <module>
from .connection import (
ModuleNotFoundError: No module named 'pip._vendor.urllib3.connection'

我正在使用mac,我确实激活了我的virtualenv。

我遇到了同样的问题,这为我解决了:pip install --upgrade pip

通过以下命令转到虚拟环境:.<your virtual env name>Scriptsactivate
并键入pip list。如果您没有看到django,请通过以下方式安装django:pip install django
如果您仍然收到此错误或新错误,请编辑帖子并将您的设置放在源代码中。感谢

最新更新