我正在使用Ubuntu 18.04和Python3.7.1。我正在尝试运行pip3,但是在lsb_release程序中出现错误:
$ pip3 -V
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 33, in vendored
__import__(vendored_name, globals(), locals(), level=0)
ModuleNotFoundError: No module named 'pip._vendor.distro'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 22, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
...
File "/usr/share/python-wheels/distro-1.0.1-py2.py3-none-any.whl/distro.py", line 932, in _get_lsb_release_info
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1.
我看不到有什么问题,文件以正确的标题开头:
#!/usr/bin/python3 -Es
我可以看到pip3确实存在:
$ whereis pip3
pip3: /usr/bin/pip3 /usr/share/man/man1/pip3.1.gz
我尝试卸载并重新安装pip3,但没有任何改变。
编辑:
这解决了我的问题: https://askubuntu.com/a/1003535/619372