gpt4 book ai didi

python - 导入错误 : cannot import name 'InvalidSchemeCombination' from 'pip._internal.exceptions'

转载 作者:行者123 更新时间:2023-12-04 04:31:32 35 4
gpt4 key购买 nike

我对编程很陌生,所以如果我出错了,请不要生气。
我将 pip 更新为最新版本(类似于 21.x.x),并尝试安装 Detectron2 Git 存储库。
但是任何与 pip 相关的东西(即使在检查它的版本时)我得到以下回溯:

Traceback (most recent call last):
File "/Users/user/opt/anaconda3/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 8, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 22, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/progress_bars.py", line 9, in <module>
from pip._internal.utils.logging import get_indentation
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 14, in <module>
from pip._internal.utils.misc import ensure_dir
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 29, in <module>
from pip._internal.locations import get_major_minor_version, site_packages, user_site
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/__init__.py", line 9, in <module>
from . import _distutils, _sysconfig
File "/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/_sysconfig.py", line 8, in <module>
from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid
ImportError: cannot import name 'InvalidSchemeCombination' from 'pip._internal.exceptions' (/Users/user/opt/anaconda3/lib/python3.8/site-packages/pip/_internal/exceptions.py)
我的问题有解决方案吗?
我也尝试降级到早期版本,但正如我所说,任何带有 pip 的评论都会给我这个回溯......
如果有人可以帮助我,我将不胜感激!

最佳答案

升级到 pip 20.x.x 后我遇到了同样的错误,GitHub( https://github.com/pypa/pip/issues/5599 ) 上有一个解决方案可以帮助我理解问题,但对我没有帮助。所以让我们来解决
解决方案

  • 手动移除或删除 pip文件和 pip-20.2.4-py3.7.egg-info目录中的文件,在您的情况下位于 /Users/user/opt/anaconda3/lib/python3.7/site-packages对于某些人来说,它位于 /home/user/anaconda3/lib/python3.7/site-packages .
  • 现在使用 conda remove --force pip从您的系统中完全删除 pip。
  • 最后,使用 conda install -c anaconda pip在您的 anaconda 环境中安装 pip。

  • 对我来说,它有效,希望它也适用于你
    祝你好运

    关于python - 导入错误 : cannot import name 'InvalidSchemeCombination' from 'pip._internal.exceptions' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67446140/

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