2018年2月16日 星期五

[Python 3.6] pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

venv建立新環境後,安裝套件又發生問題

[root@python newproject]# ./bin/pip3 install requestspip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.Collecting requests  Could not fetch URL https://pypi.python.org/simple/requests/: 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 requests (from versions: )No matching distribution found for requests

參考以下網站,為Python 3.6增加SSL能力(https://stackoverflow.com/questions/41489439/pip3-installs-inside-virtual-environment-with-python3-6-failing-due-to-ssl-modul)

(1) 安裝openssl套件
yum install -y openssl openssl-devel (CentOS 7.4)

(2) 修改Python編譯設定檔
cd /usr/src/Python-3.6.4
./configure
vi ./Module/Setup (uncomment below lines #209~212)

SSL=/usr/lib64/openssl
_ssl _ssl.c \
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
        -L$(SSL)/lib -lssl -lcrypto

make
make altinstall


沒有留言:

張貼留言