我对编程还很陌生,所以如果我出错了,请不要生气。 我将 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。
对我来说,它有效,希望它也对你有用
祝你好运
我遇到了同样的错误,以下代码为我解决了问题:
conda install pip