centos6 升級pip后導致pip不可用


問題:公司內部一台服務器在用pip安裝python某個模塊的時候提示pip需要升級,然后我就手賤升級了一下,結果悲催了,再次執行pip命令時報錯如下:

Google了下錯誤,說是:

CENTOS/RHEL 6 PYTHON PIP ERROR, SYNTAXERROR: INVALID SYNTAX {STR(C.VERSION) FOR C IN ALL_CANDIDATES}

If you’re attempting to upgrade the version of PIP on CentOS or RHEL 6 from the default 7.1.0 to a newer version, as of April 14th 2018 when PIP 10.0.0 was released you will run into issues since EL6 ships with Python 2.6 as standard. Since you cannot upgrade the default version of Python because it will break in-built tooling such as Yum, you’ll need to version lock PIP when you upgrade it to 9.0.3. This is the last stable version of PIP that is compatible with Python 2.6

用百度翻譯了下(可以看出應該是兼容性的問題):

如果您試圖將CentOS或Rhel 6上的PIP版本從默認的7.1.0升級到較新的版本,截至2018年4月14日PIP 10.0.0發布時,您將遇到問題,因為EL6以python 2.6為標准提供。由於不能升級默認版本的python,因為它會破壞內置的工具(如yum),所以在將其升級到9.0.3時,需要對pip進行版本鎖定。這是與python 2.6兼容的pip的最后一個穩定版本。

解決辦法:

#yum list python-pip
#yum erase python-pip  --刪除
#pip  --再次執行pip時報命令不存在,說明已經卸載了
#yum -y install python-pip  --重新安裝

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM