1. 程式人生 > >python下setuptools安裝( No module named setuptools 解決方案)

python下setuptools安裝( No module named setuptools 解決方案)

python下的setuptools帶有一個easy_install的工具,
在安裝python的每三方模組、工具時很有用,也很方便。
安裝setuptools前先安裝pip,請參考:linux中pip安裝步驟與使用詳解

1. 下載:
在它的官網可以下載到安裝包:
https://pypi.python.org/pypi/setuptools

頁面最下面的是它的安裝連結,如:
$wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-12.0.3.tar.gz#md5=f07e4b0f4c1c9368fcd980d888b29a65 


2. 安裝
$ tar -zxvf setuptools-12.0.3.tar.gz
$ cd setuptools=12.0.3
$ python setup.py install


3. 出現錯誤提示:
Installed /usr/local/python2.7.3/lib/python2.7/site-packages/supervisor-4.0.0_dev-py2.7.egg
Processing dependencies for supervisor==4.0.0-dev
Searching for meld3>=1.0.0
Reading https://pypi.python.org/simple/meld3/
Download error on https://pypi.python.org/simple/meld3/: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed -- Some packages may not be found!

Couldn't find index page for 'meld3' (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/: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed -- Some packages may not be found!

No local packages or download links found for meld3>=1.0.0
error: Could not find suitable distribution for Requirement.parse('meld3>=1.0.0')

解決辦法:
上網查詢了問題原因: 是curl的證書太老了需要下載最新的證書:
下載最新的證書檔案 、  
$ wget http://curl.haxx.se/ca/cacert.pem  
更名為ca-bundle.crt放置到預設目錄  
$ mv cacert.pem ca-bundle.crt 

$ mv ca-bundle.crt /etc/pki/tls/certs