python2.7的pip从8.11升级到了18.0,在查看版本时,
root@DESKTOP-N6O1LHI:~# pip -V
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
ImportError: cannot import name main
卸载后,重新apt-get install python-pip问题依旧,于是手动安装pip
root@DESKTOP-N6O1LHI:~# wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate
root@DESKTOP-N6O1LHI:~# python get-pip.py
Collecting pip
Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 18.0
Uninstalling pip-18.0:
Successfully uninstalled pip-18.0
问题you又来了:
root@DESKTOP-N6O1LHI:~# pip -V
-bash: /usr/bin/pip: No such file or directory
解决方法:
root@DESKTOP-N6O1LHI:~# type pip
pip is hashed (/usr/bin/pip)
root@DESKTOP-N6O1LHI:~# has
hascsp.dll hash
root@DESKTOP-N6O1LHI:~# has
hascsp.dll hash
root@DESKTOP-N6O1LHI:~# hash -r
root@DESKTOP-N6O1LHI:~# pip -V
pip 18.0 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
root@DESKTOP-N6O1LHI:~#
问题解决。
转载于:https://blog.51cto.com/m51cto/2162793