pip升级常见故障解决心得

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值