问题:
Whenever I am trying to install any package using pip, I am getting this import error:每当我尝试使用 pip 安装任何软件包时,都会收到此导入错误:
guru@guru-notebook:~$ pip3 install numpy
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import main
ImportError: cannot import name 'main'
guru@guru-notebook:~$ cat `which pip3`
#!/usr/bin/python3
# GENERATED BY DEBIAN
import sys
# Run the main entry point, similarly to how setuptools does it, but because
# we didn't install the actual entry point from setup.py, don't use the
# pkg_resources API.
from pip import main
if __name__ == '__main__':
sys.exit(main())
It was working fine earlier, I am not sure why it is throwing this error.早些时候它工作正常,我不知道为什么会抛出这个错误。 I have searched about this error, but can't find anything to fix it.我已经搜索过这个错误,但找不到任何可以修复它的东西。
Please let me know if you need any further detail, I will update my question.如果您需要更多详细信息,请告诉我,我会更新我的问题。
解决方案:
参考一: https://stackoom.com/question/3N6nM参考二: Error after upgrading pip: cannot import name 'main'