简体   繁体   English

降级到版本 18 后 Pip 不工作

[英]Pip isn't working after downgrading to version 18

I downgraded Pip from the most recent version using sudo python -m pip install pip==18.0 --upgrade , and now I am receiving the following error when running pip/pip3, including when trying to re-upgrade it using pip3 install --upgrade pip我使用sudo python -m pip install pip==18.0 --upgrade将 Pip 从最新版本降级,现在我在运行 pip/pip3 时收到以下错误,包括尝试使用pip3 install --upgrade pip

Traceback (most recent call last):
File "/usr/local/bin/pip3", line 5, in \<module\>
from pip.\_internal import main
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_internal/__init__.py", line 42, in \<module\>
from pip.\_internal import cmdoptions
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_internal/cmdoptions.py", line 16, in \<module\>
from pip.\_internal.index import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_internal/index.py", line 14, in \<module\>
from pip.\_vendor import html5lib, requests, six
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_vendor/html5lib/__init__.py", line 25, in \<module\>
from .html5parser import HTMLParser, parse, parseFragment
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_vendor/html5lib/html5parser.py", line 8, in \<module\>
from . import \_tokenizer
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_vendor/html5lib/\_tokenizer.py", line 16, in \<module\>
from .\_trie import Trie
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_vendor/html5lib/\_trie/__init__.py", line 3, in \<module\>
from .py import Trie as PyTrie
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_vendor/html5lib/\_trie/py.py", line 6, in \<module\>
from .\_base import Trie as ABCTrie
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/\_vendor/html5lib/\_trie/\_base.py", line 3, in \<module\>
from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/__init__.py)

Not sure if there's a specific reason you installed pip 18.0 as it looks incompatible with Python 3.10.不确定您安装 pip 18.0 是否有特定原因,因为它看起来与 Python 3.10 不兼容。 It looks like in Python 3.10 collections.Mapping moved to collections.abc.Mapping .它看起来像在 Python 3.10 collections.Mapping移动到collections.abc.Mapping I would suggest just completely uninstalling pip and reinstalling, without using pip to do so.我建议完全卸载 pip 并重新安装,而不要使用 pip 来这样做。

In general, you should try to use the latest version of pip.一般来说,你应该尽量使用最新版本的pip。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM