python3.7安装, 解决pip is configured with locations that require TLS/SSL问题
1.安装相关依赖

yum install gcc libffi-devel zlib* openssl-devel libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make -y

2.下载并解压
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
# 下载
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
# 解压并编译:
tar -xvJf Python-3.7.1.tar.xz
cd Python-3.7.1

3.编译安装
./configure prefix=/usr/local/python3
make && make install
# 编译完成后,创建软链接文件到执行文件路径:
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
# 我们可以清除之前编译的可执行文件及配置文件 && 清除所有生成的文件:
make clean && make distclean

bug: 使用pip 命令失败
2.1 错误信息
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting virtualenv
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/virtualenv/
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/virtualenv/
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/virtualenv/
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/virtualenv/
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/virtualenv/
Could not fetch URL https://pypi.org/simple/virtualenv/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/virtualenv/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not find a version that satisfies the requirement virtualenv (from versions: )
No matching distribution found for virtualenv
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.")) - skipping

2.2 原因
系统版本centos6.5,其中openssl的版本为OpenSSL 1.0.1e-fips 11 Feb 2013,而python3.7需要的openssl的版本为1.0.2或者1.1.x,需要对openssl进行升级,并重新编译python3.7.0。yum 安装的openssl 版本都比较低。

2.3 升级openssl
# 1.下贼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
# 2.编译安装
./config --prefix=/usr/local/openssl no-zlib #不需要zlib
make
make install
# 3.备份原配置
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl/ /usr/include/openssl.bak
# 4.新版配置
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
# 5.修改系统配置
## 写入openssl库文件的搜索路径
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
## 使修改后的/etc/ld.so.conf生效
ldconfig -v
# 6.查看openssl版本
openssl version

openssl version 提示:

/usr/local/openssl/bin/openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory

假如你的libssl.so.1.1 文件在/usr/local/openssl/lib/下面,可以这样做

ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1

ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

3.3 重新安装python
./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl
make
make install

导出Python环境安装包
[root@bogon ~]# pip freeze > packages.txt
这将会创建一个 packages.txt文件,其中包含了当前环境中所有包及各自的版本的简单列表(即pip list 所列出的包列表)
安装导入Python环境包
[root@bogon ~]# pip install -r packages.txt

解决pip is configured with locations that require TLS/SSL问题的更多相关文章

  1. python3.7安装, 解决pip is configured with locations that require TLS/SSL问题

    python3.7安装, 解决pip is configured with locations that require TLS/SSL问题1.安装相关依赖 yum install gcc libff ...

  2. pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

    # 背景 安装pip后发现执行pip install pytest,提示下面错误 pip is configured with locations that require TLS/SSL, howe ...

  3. pip install 时报错 pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

    pip install 时报错: pip is configured with locations that require TLS/SSL, however the ssl module in Py ...

  4. 编译安装Python出现“pip is configured with locations that require TLS/SSL, however the ssl.....”

    ubuntu: sudo apt-get install libssl-dev Cenos: sudo yum install openssl-devel 重新编译: ./configure --en ...

  5. python3.7.2 pip 出现locations that require TLS/SSL异常处理方法

    centos7安装python3.7.2后,运行 pip3 install tornado 会报错 [root@localhost ~]# pip3 install tornado pip is co ...

  6. python pip 出现locations that require TLS/SSL异常处理方法

    python pip 出现locations that require TLS/SSL异常处理方法 转载 郑才华 发布于2018-03-24 21:41:16 阅读数 51844 收藏 展开 最近在r ...

  7. python3.6 pip 出现locations that require TLS/SSL异常解决方案

    在给CentOS服务器安装完Python3.6后,使用pip命令出现问题,提示说无法找到ssl模块. 上网查询后发现在安装Python3.6时没有安装openssl-devel依赖库,解决方案如下: ...

  8. 解决Linux 安装python3 .5 解决pip 安装无法成功问题ssl安全拦截无法pip安装库问题

    pip is configured with locations that require TLS/SSL, however the ssl module in Python is not avail ...

  9. 【转】Win10下python3和python2多版本同时安装并解决pip共存问题

    [转]Win10下python3和python2多版本同时安装并解决pip共存问题 特别说明,本文是在Windows64位系统下进行的,32位系统请下载相应版本的安装包,安装方法类似. 使用pytho ...

随机推荐

  1. Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: No Persistence provider for EntityManager named null

    swing Exception in thread "AWT-EventQueue-0" javax.persistence.PersistenceException: No Pe ...

  2. jnhs-springmvc 请求组合不正确,比如请求路径出现两次

    初学springmvc 向后台传参数,结果发现,一直404 404后没有路径,说明 没有进入controller 仔细一看,请求路径不对,重复出现 页面是这样写的 页面是这样写的 原因是,请求链接和当 ...

  3. java-日期类

    一 显示系统时间 package cn.itcast.api.a.date; import java.text.DateFormat; import java.util.Date; public cl ...

  4. Codeforces 1150D(字符串dp)

    反思 三维的dp压根没看出来,看题解以后思路又很直观,找几道字符串dp练练才行 序列自动机和优化一维略 /* __ __ * ____| |_____| |____ * | | * | __ | * ...

  5. Leetcode661.Image Smoother图片平滑器

    包含整数的二维矩阵 M 表示一个图片的灰度.你需要设计一个平滑器来让每一个单元的灰度成为平均灰度 (向下舍入) ,平均灰度的计算是周围的8个单元和它本身的值求平均,如果周围的单元格不足八个,则尽可能多 ...

  6. TP5.1 首页路由

    把自带的return 删了

  7. 导出excel表

    <?phppublic function export(){          #提现状态               $status = isset($_REQUEST['status'])? ...

  8. 关于本地文件请求json文件

    因为需要用到json数据格式,上网查了一下例子之后我就想本地测试一下看能不能成功. 结果,chrome下没有任何反应,打开控制台之后报错如下: XMLHttpRequest cannot load f ...

  9. chrome浏览器 新打开的页面覆盖当前页面

    chrome浏览器  本应该新打开一个页面,却覆盖了当前页面. 解决办法:使用鼠标中键打开一次,后续即可正常使用.

  10. Hdu 1025(LIS)

    Constructing Roads In JGShining's Kingdom Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65 ...