gpt4 book ai didi

python - 属性错误: module 'pip._internal.download' has no attribute 'HTTPAdapter'

转载 作者:行者123 更新时间:2023-11-30 21:54:49 32 4
gpt4 key购买 nike

我最近将我的 pip 升级到了 19.3。当我这样做时,我无法使用任何 pip 命令。操作系统 - Mac

当我用谷歌搜索并进行更多研究时,大多数建议都是降级 pip 包。然而,即使我尝试了,我也得到了相同的结果。事实上,强制安装或卸载或 sudo 命令没有任何作用。

Traceback (most recent call last):
File "/Users/.virtualenvs/myvenv/bin/pip", line 10, in <module>
sys.exit(main())
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip/_internal/main.py", line 45, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 21, in <module>
from pip._internal.operations.prepare import RequirementPreparer
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 17, in <module>
from pip._internal.download import unpack_url
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/wrapt/importer.py", line 158, in load_module
notify_module_loaded(module)
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/wrapt/decorators.py", line 443, in _synchronized
return wrapped(*args, **kwargs)
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/wrapt/importer.py", line 136, in notify_module_loaded
hook(module)
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip_system_certs/wrapt_pip.py", line 8, in apply_patches
override_ssl_handler(download)
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip_system_certs/wrapt_pip.py", line 17, in override_ssl_handler
class SslContextHttpAdapter(download.HTTPAdapter):
AttributeError: module 'pip._internal.download' has no attribute 'HTTPAdapter'

有人可以帮忙吗?

最佳答案

这似乎是因为您安装了 pip-system-certs包,它以从未支持的方式 Hook 到 pip 内部。一旦你更新了pip并且pip-system-certs想要搞乱的东西被改变了,这个问题就会立即崩溃。

您至少需要摆脱pip-system-certs。看起来它是安装在 virtualenv 中的,因此您可能可以停用该 env 并创建一个新的...但如果是这样,那么您似乎已经尝试过了。如果您还没有尝试过,请确保下次尝试一下!如果您已经尝试过这样做,那么您可能破坏的东西比我们看到的要多,并且您可能需要更严厉的措施,例如完整的 Python 重新安装。

关于python - 属性错误: module 'pip._internal.download' has no attribute 'HTTPAdapter' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58386140/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com