在 Python 3.7.2 中损坏了 pip
Broke pip in Python 3.7.2
来自 pip 的任何调用都会给我这个错误:
Traceback (most recent call last):
File "/usr/sbin/pip", line 11, in <module>
load_entry_point('pip==18.1', 'console_scripts', 'pip')()
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
return ep.load()
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2411, in load
return self.resolve()
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2417, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3.7/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 22, in <module>
from pip._internal.utils.ui import BAR_TYPES
File "/usr/lib/python3.7/site-packages/pip/_internal/utils/ui.py", line 15, in <module>
from pip._vendor.progress import HIDE_CURSOR, SHOW_CURSOR
ImportError: cannot import name 'HIDE_CURSOR' from 'pip._vendor.progress' (/usr/lib/python3.7/site-packages/pip/_vendor/progress/__init__.py)
我使用基于 Arch Linux 的 Manjaro Linux。
只需 运行 这些命令:
sudo pacman -Rns python-pip
sudo rm -r /usr/lib/python3.7/site-packages/pip/
sudo pacman -S python-pip
您需要将 pip 版本更新到 19:
运行 以下:
sudo pacman -Rns python-pip
sudo rm -rf /usr/lib/python3.7/site-packages/pip
sudo python3.7 -m ensurepip
sudo pip install --upgrade pip
来自 pip 的任何调用都会给我这个错误:
Traceback (most recent call last):
File "/usr/sbin/pip", line 11, in <module>
load_entry_point('pip==18.1', 'console_scripts', 'pip')()
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2793, in load_entry_point
return ep.load()
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2411, in load
return self.resolve()
File "/usr/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2417, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3.7/site-packages/pip/_internal/__init__.py", line 40, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3.7/site-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3.7/site-packages/pip/_internal/cli/main_parser.py", line 8, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3.7/site-packages/pip/_internal/cli/cmdoptions.py", line 22, in <module>
from pip._internal.utils.ui import BAR_TYPES
File "/usr/lib/python3.7/site-packages/pip/_internal/utils/ui.py", line 15, in <module>
from pip._vendor.progress import HIDE_CURSOR, SHOW_CURSOR
ImportError: cannot import name 'HIDE_CURSOR' from 'pip._vendor.progress' (/usr/lib/python3.7/site-packages/pip/_vendor/progress/__init__.py)
我使用基于 Arch Linux 的 Manjaro Linux。
只需 运行 这些命令:
sudo pacman -Rns python-pip
sudo rm -r /usr/lib/python3.7/site-packages/pip/
sudo pacman -S python-pip
您需要将 pip 版本更新到 19: 运行 以下:
sudo pacman -Rns python-pip
sudo rm -rf /usr/lib/python3.7/site-packages/pip
sudo python3.7 -m ensurepip
sudo pip install --upgrade pip