1. 程式人生 > >centos 6.5t升級python注意事頂及遇到問題的解決方法

centos 6.5t升級python注意事頂及遇到問題的解決方法

1. 安裝依賴包

必須安裝的二個依賴: zlib-devel, openssl-devel

如果沒有安裝zlib-devel這個出錯,容易看出來。但openssl-devel沒安裝的話,出錯很難看出來。 現像見後文。

2. 原始碼編譯安裝python 

 https://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz

3. 原始碼編譯安裝setuptools

https://pypi.python.org/packages/source/s/setuptools/setuptools-16.0.tar.gz

4. 使用easy_install 安裝pip

 easy_install pip

出錯現像及解決方法:

Searching for pip
Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: unknown url type: https -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: unknown url type: https -- Some packages may not be found!
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')
解決方法:

  安裝openssl-devel包,然後重新安裝python