centos解決Could not find a version that satisfies the requirement pip3 (from versions: none)及No mat...

python環境:python 3.8html

報錯信息:python

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting pip3
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip3/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip3/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip3/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip3/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip3/
  Could not fetch URL https://pypi.org/simple/pip3/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip3/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  ERROR: Could not find a version that satisfies the requirement pip3 (from versions: none)
ERROR: No matching distribution found for pip3
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skippingcentos

安裝python 3.8的方法:centos安裝httprunner方法fetch

執行命令:ui

#pip install httprunnerurl

報錯:使用pip 命令失敗,見頂部「報錯信息」spa

解決辦法:升級opensslhtm

一、查看openssl版本blog

# openssl versionip

OpenSSL 1.0.1e-fips 11 Feb 2013

# cat /etc/issue               
CentOS release 6.6 (Final)
Kernel \r on an \m

緣由:系統版本centos6.6,其中openssl的版本爲OpenSSL 1.0.1e-fips 11 Feb 2013,而python3.8須要的openssl的版本爲1.0.2或者1.1.x,須要對openssl進行升級,並從新編譯python3.8.0。

注意:yum 安裝的openssl 版本都比較低。
二、下載openssl
#wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz
#tar -zxvf openssl-1.1.1a.tar.gz
#cd openssl-1.1.1a
三、編譯安裝
#./config --prefix=/usr/local/openssl no-zlib #不須要zlib
#make && make install
四、備份原配置
#mv /usr/bin/openssl /usr/bin/openssl.bak
#mv /usr/include/openssl/ /usr/include/openssl.bak
五、新版配置
#ln -s /usr/local/openssl/include/openssl /usr/include/openssl
#ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/local/lib64/libssl.so
#ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
六、修改系統配置
1)寫入openssl庫文件的搜索路徑
#echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
2)使修改後的/etc/ld.so.conf生效
#ldconfig -v
七、查看openssl版本

# openssl version

OpenSSL 1.1.1a  20 Nov 2018

八、從新安裝python

進入python解壓縮文件夾,執行
#./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl
#make
#make install

------------------------------------------------------Tanwheey--------------------------------------------------

愛生活,愛工做。

相關文章
相關標籤/搜索