本文共 1128 字,大约阅读时间需要 3 分钟。
python2.7的pip从8.11升级到了18.0,在查看版本时,
root@DESKTOP-N6O1LHI:~# pip -VTraceback (most recent call last): File "/usr/bin/pip", line 9, infrom pip import mainImportError: cannot import name main
卸载后,重新apt-get install python-pip问题依旧,于是手动安装pip
root@DESKTOP-N6O1LHI:~# wget https://bootstrap.pypa.io/get-pip.py --no-check-certificateroot@DESKTOP-N6O1LHI:~# python get-pip.pyCollecting pip Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whlInstalling 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 pippip is hashed (/usr/bin/pip)root@DESKTOP-N6O1LHI:~# hashascsp.dll hashroot@DESKTOP-N6O1LHI:~# hashascsp.dll hashroot@DESKTOP-N6O1LHI:~# hash -rroot@DESKTOP-N6O1LHI:~# pip -Vpip 18.0 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)root@DESKTOP-N6O1LHI:~#
问题解决。
转载于:https://blog.51cto.com/m51cto/2162793