安裝openssl-1.1.1


1.前因

  python 導入clickhouse_driver需要import ssl和_ssl,報錯  

  File "/home/oracle/python3/lib/python3.7/site-packages/clickhouse_driver-0.1.2-py3.7-linux-x86_64.egg/clickhouse_driver/__init__.py", line 2, in <module>
    from .client import Client
  File "/home/oracle/python3/lib/python3.7/site-packages/clickhouse_driver-0.1.2-py3.7-linux-x86_64.egg/clickhouse_driver/client.py", line 1, in <module>
    import ssl
  File "/home/oracle/python3/lib/python3.7/ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: libssl.so.1.1: cannot open shared object file: No such file or director 

  查看openssl安裝情況  

[root@localhost ~]# rpm -aq|grep openssl
openssl-1.0.1e-58.el6_10.x86_64
openssl-devel-1.0.1e-58.el6_10.x86_64

  版本是1.0.1e,不符合需求

2.下載openssl

  從 openssl官網下載最新的代碼包,因為源站下載速度過慢,所以我使用了騰訊雲的鏡像

#從官網下載
# wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz

#騰訊雲提供的鏡像
wget https://mirrors.cloud.tencent.com/openssl/source/openssl-1.1.1g.tar.gz

3. 編譯 openssl

tar -xvf openssl-1.1.1g.tar.gz
cd openssl-1.1.1g
./config shared --openssldir=/usr/local/openssl --prefix=/usr/local/openssl
make && make install

4.配置

echo "/usr/local/openssl/lib/" >> /etc/ld.so.conf
ldconfig

5.測試

[oracle@localhost ~]$ python3
Python 3.7.2rc1 (default, Nov  1 2019, 08:59:21) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> 

  成功!

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM