Benjamin Zhang

目前就职于中科院计算机网络信息中心,主要兴趣集中在数据库,操作系统,中间件。

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

29 Sep 2019 »

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

pip安装模块错误

参考文档:安装Python3

[root@oradb binlog2sql]# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip

错误日志

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

解决思路:

cd /u01/soft/openssl-1.0.2t
./config --prefix=/usr/local/ssl shared zlib
make && make install

###添加一行记录/usr/local/lib至local.conf文件中。
[root@oradb openssl-1.0.2t]# cat /etc/ld.so.conf.d/local.conf 
/usr/local/ssl/lib
ldconfig -v
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak

ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl

[root@oradb lib]# openssl version
OpenSSL 1.0.2t  10 Sep 2019

python编译

cd /usr/local/Python-3.7.4/
./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/ssl --enable-shared
make
make install

错误2

[root@oradb binlog2sql]# pip install -r requirements.txt
/usr/local/python3/bin/python3.7: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
[root@oradb lib]# cd /etc/ld.so.conf.d/
[root@oradb ld.so.conf.d]# vim python3.conf
/usr/local/python3/lib


ldconfig -v

安装成功:

[root@oradb binlog2sql]# pip install -r requirements.txt
Collecting PyMySQL==0.7.11 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/c6/42/c54c280d8418039bd2f61284f99cb6d9e0eae80383fc72ceb6eac67855fe/PyMySQL-0.7.11-py2.py3-none-any.whl (78kB)
     |████████████████████████████████| 81kB 1.1MB/s 
Collecting wheel==0.29.0 (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/8a/e9/8468cd68b582b06ef554be0b96b59f59779627131aad48f8a5bce4b13450/wheel-0.29.0-py2.py3-none-any.whl (66kB)
     |████████████████████████████████| 71kB 2.6MB/s 
Collecting mysql-replication==0.13 (from -r requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/dd/23/384047702e694139e9fe75a8ba7ad007e8942fd119ebadabc32ce19f70f2/mysql-replication-0.13.tar.gz
Installing collected packages: PyMySQL, wheel, mysql-replication
  Running setup.py install for mysql-replication ... done
Successfully installed PyMySQL-0.7.11 mysql-replication-0.13 wheel-0.29.0