[英]ImportError: cannot import name 'InvalidSchemeCombination' from 'pip._internal.exceptions'
I am quite new to programming so don't be mad if I get something wrong.我对编程很陌生,所以如果我出错了,不要生气。 I updated pip to its latest version (something like 21.xx) and I tried to install the Detectron2 Git repo.
我将 pip 更新到其最新版本(类似于 21.xx),并尝试安装 Detectron2 Git 存储库。 But anything related with pip (even when checking its version) I get the following Traceback:
但是与 pip 相关的任何内容(即使在检查其版本时)我都会得到以下 Traceback:
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)
Is there a solution for my problem?我的问题有解决方案吗? I also tried downgrading to an earlier version but as I said any comment with pip inside gives me this Traceback...
我也尝试降级到早期版本,但正如我所说的,任何带有 pip 的评论都给了我这个 Traceback ......
If anyone out there can help me I would be so grateful!如果有人可以帮助我,我将不胜感激!
I was having the same error after upgrading to pip 20.xx, there is a solution on GitHub( https://github.com/pypa/pip/issues/5599 ) which helped me to understand the problem, but it doesn't help me.升级到 pip 20.xx 后我遇到了同样的错误,GitHub 上有一个解决方案( https://github.com/pypa/pip/issues/5599 )帮助我理解了这个问题,但它没有帮我。 So let's come to the solution
所以让我们来解决
Manually remove or delete the pip
file and pip-20.2.4-py3.7.egg-info
file from the directory, which in your case is located in /Users/user/opt/anaconda3/lib/python3.7/site-packages
and for some it's in /home/user/anaconda3/lib/python3.7/site-packages
.从目录中手动删除或删除
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
。
Now use conda remove --force pip
to completely remove pip from your system.现在使用
conda remove --force pip
从系统中完全删除 pip。
Finally, use conda install -c anaconda pip
to install pip in your anaconda environment.最后,使用
conda install -c anaconda pip
安装 pip 到您的 Z7E3332C5FD25BA110D9ADC964E 环境中。
For me, it worked, hope it will work for you too对我来说,它有效,希望它对你也有效
best of luck祝你好运
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.