环境:CentOS release 6.8 (Final)

# 直接编译python3.7在使用pip3安装依赖的时候报错:

Can't connect to HTTPS URL because the SSL module is not available.

解决方法:

.编译安装OpenSSL 1.0.2j版本并重新配置环境变量

下载OpenSSL源码包:
wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz 解压缩,编译安装:
tar -zxvf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j
./config --prefix=/usr/local/lab/openssl-1.0.2j shared zlib
make && make install .编译安装Python3,使用自定义的OpenSSL 下载Python3..3源码包: wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz 解压缩,编译安装: tar -zxvf Python-3.7..tgz
cd Python-3.7.
./configure --prefix=/usr/local/python373 在这一步之后,先不要着急运行make命令。先修改源码目录 Python-3.7./Modules/Setup 文件: # Socket module helper for socket()
#_socket socketmodule.c # Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/lab/openssl-1.0.2j/ #取消这一行的注释,并将原来的/usr/local/ssl改为我们新安装的openssl目录:/usr/local/lab/openssl-1.0.2j/
_ssl _ssl.c \ #取消这一行的注释
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ #取消这一行的注释
-L$(SSL)/lib -lssl -lcrypto #取消这一行的注释 # The crypt module is now disabled by default because it breaks builds
# on many systems (where -lcrypt is needed), e.g. Linux (I believe). #_crypt _cryptmodule.c # -lcrypt # crypt(); needs -lcrypt on some systems 修改完成以后,还需要创建两个指向动态链接库的软链接文件:
ln -s /usr/local/lab/openssl-1.0.2j/lib/libssl.so.1.0. /usr/lib64/libssl.so.1.0.
ln -s /usr/local/lab/openssl-1.0.2j/lib/libcrypto.so.1.0. /usr/lib64/libcrypto.so.1.0. 最后编译并安装:
make && make install # 创建软连接
ln -s /usr/local/python373/bin/pip3 /usr/local/bin/pip3
ln -s /usr/local/python373/bin/python3 /usr/local/bin/python3 # 安装软件继续报错:
[root@srv3:/usr/local]# pip3 install requests
Collecting requests
/usr/local/python373/bin/python3.: symbol lookup error: /usr/local/python373/bin/python3.: undefined symbol: SSL_CTX_get0_param # 找了各自资料发现都无法解决这个问题,问题很可能就出在openssl上 undefined symbol: SSL_CTX_get0_param 这个函数就是zlib源码中的函数,于是重新编译openssl .清理之前安装的openssl
rm -rf /usr/local/src/openssl-1.0.2j # 清理源码
rm -rf /usr/local/lab/openssl-1.0.2j # 清理安装程序 tar -zxvf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j
# 修改编译参数,no-zlib 不需要zlib
./config --prefix=/usr/local/lab/openssl-1.0.2j no-zlib
make && make install .重新编译安装Python3.7.3 # 清理源码目录和已经按照的目录
rm -rf /usr/local/src/Python-3.7.
rm -rf /usr/local/python373 # 再次解压编译安装
tar -zxvf Python-3.7..tgz
cd Python-3.7.
./configure --prefix=/usr/local/python373 在这一步之后,先不要着急运行make命令,先修改源码目录 Python-3.7./Modules/Setup 文件: # Socket module helper for socket()
#_socket socketmodule.c # Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/lab/openssl-1.0.2j/ #取消这一行的注释,并将原来的/usr/local/ssl改为我们新安装的openssl目录:/usr/local/lab/openssl-1.0.2j/
_ssl _ssl.c \ #取消这一行的注释
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ #取消这一行的注释
-L$(SSL)/lib -lssl -lcrypto #取消这一行的注释 # The crypt module is now disabled by default because it breaks builds
# on many systems (where -lcrypt is needed), e.g. Linux (I believe). #_crypt _cryptmodule.c # -lcrypt # crypt(); needs -lcrypt on some systems 最后编译并安装:
make && make install # 再次pip3安装依赖就不会报错了
[root@srv3:/usr/local/src/Python-3.7.]# pip3 install requests
Collecting requests
Downloading https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl (57kB)
% |████████████████████████████████| 61kB .1MB/s
Collecting certifi>=2017.4. (from requests)
Downloading https://files.pythonhosted.org/packages/69/1b/b853c7a9d4f6a6d00749e94eb6f3a041e342a885b87340b79c1ef73e3a78/certifi-2019.6.16-py2.py3-none-any.whl (157kB)
% |████████████████████████████████| 163kB .3MB/s
Collecting idna<2.9,>=2.5 (from requests)
Downloading https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl (58kB)
% |████████████████████████████████| 61kB .8MB/s
Collecting chardet<3.1.,>=3.0. (from requests)
Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
% |████████████████████████████████| 143kB .9MB/s
Collecting urllib3!=1.25.,!=1.25.,<1.26,>=1.21. (from requests)
Downloading https://files.pythonhosted.org/packages/e6/60/247f23a7121ae632d62811ba7f273d0e58972d75e58a94d329d51550a47d/urllib3-1.25.3-py2.py3-none-any.whl (150kB)
% |████████████████████████████████| 153kB .8MB/s
Installing collected packages: certifi, idna, chardet, urllib3, requests
Successfully installed certifi-2019.6. chardet-3.0. idna-2.8 requests-2.22. urllib3-1.25.

centos6.8安装python3.7.3报错Can't connect to HTTPS URL because the SSL module is not available问题解决的更多相关文章

  1. python pip安装模块报错 "Can't connect to HTTPS URL because the SSL module is not available."

    在升级python版本为3.6之后,pip安装模块报错. 报错信息如图: 原因是系统自带的openssl版本与python3的版本不匹配,所以这里只要升级openssl版本就可以解决问题. yum - ...

  2. centos7中python3.6报错ModuleNotFoundError: No module named '_ssl' 或者 Max retries exceeded with url: / (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",))

    如果在运行爬虫时报此错:requests.exceptions.SSLError: HTTPSConnectionPool(host='www.baidu.com', port=443): Max r ...

  3. 在centos6.7通过源码安装python3.6.7报错“zipimport.ZipImportError: can't decompress data; zlib not available”

    在centos6.7通过源码安装python3.6.7报错: zipimport.ZipImportError: can't decompress data; zlib not available 从 ...

  4. 下载安装go插件包报错fatal: unable to access 'https://github.com/golang/tools.git/': OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054

    使用git命令来给vscode安装go插件的时候报错,如下: $ git clone https://github.com/golang/tools.git tools Cloning into 't ...

  5. windows 安装python3.5启动报错:api-ms-win-crt-runtime-l1-1-0.dll丢失

    下载: api-ms-win-crt-runtime就是MFC的运行时环境的库,python在windows上编译也是用微软的visual studio C++编译的,底层也会用到微软提供的C++库和 ...

  6. 安装RabbitMQ3.6.10报错:{error,{missing_dependencies,[crypto,ssl],

    参考https://blog.csdn.net/u010739551/article/details/80848993 如果安装上篇博文安装则可避免这种情况 CentOS6.7安装RabbitMQ3. ...

  7. centos6.8安装python3.7无法import _ssl

    转载https://www.jianshu.com/p/ace9be0b08ed 公司运维提供的服务器是centos6.8,打算在上面装python3.7,结果费尽周折,按照网上的步骤python3. ...

  8. Python3 pip命令报错:Fatal error in launcher: Unable to create process using '"'

    Python3 pip命令报错:Fatal error in launcher: Unable to create process using '"' 一.问题 环境:win7 同时安装py ...

  9. Python学习笔记之Centos6.9安装Python3.6

    0x00 注意 如果本机安装了python2,尽量不要管他,使用python3运行python脚本就好,因为可能有程序依赖目前的python2环境, 比如yum!!!!! 不要动现有的python2环 ...

随机推荐

  1. xinetd配置文件

    xinetd是一个超级守护进程xinetd即extended internet daemon,xinetd是新一代的网络守护进程服务程序,又叫超级Internet服务器.经常用来管理多 种轻量级Int ...

  2. K8S集群证书已过期且etcd和apiserver已不能正常使用下的恢复方案

    在这种比较极端的情况下,要小心翼翼的规划和操作,才不会让集群彻底死翘翘.首先,几个ca根证书是10年期,应该还没有过期.我们可以基于这几个根证书,来重新生成一套可用的各组件认证证书. 前期,先制定以下 ...

  3. 大小端示例-arm c51

    大小端系列文章https://blog.csdn.net/liming0931/article/details/100016425 MDK(Keil5,STM32F407)C语言: #include  ...

  4. ArrayList && LinkList

    1.ArrayList是实现了基于动态数组的数据结构,LinkedList基于链表的数据结构. 2.对于随机访问get和set,ArrayList觉得优于LinkedList,因为LinkedList ...

  5. matlat保存矩阵数据

    a=[1 2 3; 4 5 6]; fid = fopen('haha.txt', 'w+');fprintf(fid,'%8.4f %8.3f %d\n', a');fclose(fid); typ ...

  6. java利用反射动态获取实体类的属性值

    直接贴代码吧,有需要的话,可以根据自己的需要修改部分代码: public BigDecimal getByAttributeName(ThmdGwqriR thmdGwqriR, String att ...

  7. 【shell】2、判断表达式、if语句

    文件类型判断 test -e filename:该文件名是否存在 test -f filename:该文件名是否存在且为文件(file) test -d filename:该文件名是否存在且为目录(d ...

  8. 初【001】——Python 基础知识

    1.python基础入门 提示: 语法基于python3.x版本(会提示2.x版本和3.x版本的区别) Python命令行将以>>>开始,比如 >>>print ( ...

  9. 2017.10.7 国庆清北 D7T2 第k大区间

    题目描述 定义一个长度为奇数的区间的值为其所包含的的元素的中位数. 现给出n个数,求将所有长度为奇数的区间的值排序后,第K大的值为多少. 输入输出格式 输入格式: 输入文件名为kth.in. 第一行两 ...

  10. luogu P1160 队列安排

    二次联通门 :luogu P1160 队列安排 /* luogu P1160 队列安排 链表 手动模拟一下就好了... */ #include <cstdio> #define Max 5 ...