Python3中pip3安裝模塊出錯,找不到SSL

CentOS6上安裝完Python3,用pip3以後一直報錯,提示沒有ssl模塊python

例如這樣:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting xxx
Could not fetch URL https://pypi.python.org/simple/xxxx/: There was a problem confirming the ssl certificate: Can’t connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement xxx (from versions: )
No matching distribution found for xxxmarkdown

網上查說是缺乏OpenSSL-dev,可是我本機是已經安裝了OpenSSL的fetch

因而我進入Python2,導入ssl模塊沒有問題,可是進入Python3,導入ssl模塊報錯了ui

本人查閱資料發現,在./configure過程當中,若是沒有加上–with-ssl參數時,默認安裝的軟件涉及到ssl的功能不可用,恰好pip3過程須要ssl模塊,而因爲沒有指定,因此該功能不可用。code

解決辦法是從新對python3.6進行編譯安裝,用一下過程來實現編譯安裝:ip

cd Python-3.6.2
./configure --with-ssl
make
sudo make install

這樣就容許安裝的python3使用ssl功能模塊,進入python3中,執行import ssl發現未出錯,正常再次調用pip3指令來安裝paramiko,發現正常,問題解決!ssl

相關文章
相關標籤/搜索