解決Ubuntu16.04 pip報(bào)錯(cuò) ImportError: No module named 'pip'

1.背景

ubuntu16.04的系統(tǒng),使用pip命令時(shí)提示

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020.
Please upgrade your Python as Python 2.7 won't be maintained after that date. 
A future version of pip will drop support for Python 2.7.
Requirement already satisfied: lolcat in /usr/local/lib/python2.7/dist-packages (0.44)

于是就升級(jí)python的版本到3.5,升級(jí)完成后,也將系統(tǒng)默認(rèn)的python改為python3.5版本的,一切OK之后
重新使用pip安裝文件,就報(bào)錯(cuò)

Traceback (most recent call last):
   File "/usr/local/bin/pip", line 7, in <module>
     from pip._internal import main
ImportError: No module named 'pip'

2.解決

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

由于我將升級(jí)的3.5版本的python作為默認(rèn)版本,所以直接使用了python這個(gè)命令

python get-pip.py --force-reinstall

如果默認(rèn)的python版本為python2版本,使用以下命令

python3.5 get-pip.py --force-reinstall
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容