1. 程式人生 > >CentOS7 安裝 Python3.7 及 SSL 編譯錯誤處理

CentOS7 安裝 Python3.7 及 SSL 編譯錯誤處理

下載: https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz

解包:tar -zxvf Python-3.7.0.tgz

進入 Python-3.7.0 目錄:

    cd Python-3.7.0

1. 安裝必要的依賴模組:

執行下面的安裝指令:

[[email protected] Python-3.7.0]$ sudo yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite sqlite-devel readline-devel tk tk-devel gdbm gdbm-devel db4-devel libpcap-devel lzma xz xz-devel libuuid-devel libffi-devel

2. 嘗試配置、編譯

[[email protected] Python-3.7.0]$ ./configure --prefix=/usr
[[email protected] Python-3.7.0]$ make


編譯錯誤:
Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381

3. 安裝 libressl 代替openssl-devel
-------------------------------------------------------------------------------------------------------------------------

libressl 是 openssl 更安全版本分支,生產環境建議使用 libressl 替代 openssl。


下載最新穩定版本 2.7.4

https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.7.4.tar.gz

解壓:
    tar -zxvf libressl-2.7.4.tar.gz

編譯安裝:
    [[email protected] libressl-2.7.4]$ cd libressl-2.7.4
    [[email protected] libressl-2.7.4]$ ./configure --prefix=/usr/local
    [[email protected] libressl-2.7.4]$ sudo make install

新建或修改 /etc/ld.so.conf.d/local.conf 配置檔案,新增如下內容:
    /usr/local/lib
    
即將 /usr/local/lib 目錄加入到模組載入目錄。

重新載入共享模組:
    [[email protected] Python-3.7.0]$ sudo ldconfig -v

    [[email protected] Python-3.7.0]$ openssl version
    LibreSSL 2.7.4

4. 安裝 libressl 代替openssl-devel
-------------------------------------------------------------------------------------------------------------------------
回到 Python-3.7.0 目錄,編輯安裝檔案 Modules/Setup

刪除有關 ssl 編譯程式碼的註釋,共 4 行,並修改 SSL 目錄為 SSL=/usr/local, 如下所示:

# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local
_ssl _ssl.c \
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
        -L$(SSL)/lib -lssl -lcrypto

重新配置、編譯:

   [[email protected] Python-3.7.0]$ ./configure --prefix=/usr

    [[email protected] Python-3.7.0]$ make

編譯成功,沒有報錯,執行安裝:
    [[email protected] Python-3.7.0]$ sudo make install

測試一下:
    [[email protected] Python-3.7.0]$ python3
    Python 3.7.0 (default, Sep  6 2018, 11:51:44)
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
    Type "help", "copyright", "credits" or "license" for more information.

    >>> import ssl
    >>> import uuid
    >>>

OK.


5. 升級 pip
-------------------------------------------------------------------------------------------------------------------------
[[email protected] Python-3.7.0]$ sudo python3 -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 114kB/s
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
Successfully installed pip-18.0


OK.

6. 安裝 mysql-connector, PyMySQL
-------------------------------------------------------------------------------------------------------------------------
[[email protected] Python-3.7.0]$ sudo pip3 install mysql-connector
Collecting mysql-connector
  Downloading https://files.pythonhosted.org/packages/59/e0/775bf5fb3dd4c7f9aa6877907d4a96eecca6886c603dedfea6e843e94560/mysql-connector-2.1.6.tar.gz (11.8MB)
    100% |████████████████████████████████| 11.8MB 40kB/s
Installing collected packages: mysql-connector
  Running setup.py install for mysql-connector ... done
Successfully installed mysql-connector-2.1.6


[[email protected] Python-3.7.0]$ sudo pip3 install PyMySQL
Collecting PyMySQL
  Downloading https://files.pythonhosted.org/packages/a7/7d/682c4a7da195a678047c8f1c51bb7682aaedee1dca7547883c3993ca9282/PyMySQL-0.9.2-py2.py3-none-any.whl (47kB)
    100% |████████████████████████████████| 51kB 225kB/s
Collecting cryptography (from PyMySQL)
  Downloading https://files.pythonhosted.org/packages/59/32/92cade62c645756a83598edf56289e9b19aae5370642a7ce690cd06bc72f/cryptography-2.3.1-cp34-abi3-manylinux1_x86_64.whl (2.1MB)
    100% |████████████████████████████████| 2.1MB 83kB/s
Collecting cffi!=1.11.3,>=1.7 (from cryptography->PyMySQL)
  Downloading https://files.pythonhosted.org/packages/51/7b/d1014289d0578c3522b2798b9cb87c65e5b36798bd3ae68a75fa1fe09e78/cffi-1.11.5-cp37-cp37m-manylinux1_x86_64.whl (421kB)
    100% |████████████████████████████████| 430kB 77kB/s
Collecting idna>=2.1 (from cryptography->PyMySQL)
  Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
    100% |████████████████████████████████| 61kB 108kB/s
Collecting asn1crypto>=0.21.0 (from cryptography->PyMySQL)
  Downloading https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)
    100% |████████████████████████████████| 102kB 135kB/s
Collecting six>=1.4.1 (from cryptography->PyMySQL)
  Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting pycparser (from cffi!=1.11.3,>=1.7->cryptography->PyMySQL)
  Downloading https://files.pythonhosted.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz (245kB)
    100% |████████████████████████████████| 256kB 86kB/s
Installing collected packages: pycparser, cffi, idna, asn1crypto, six, cryptography, PyMySQL
  Running setup.py install for pycparser ... done
Successfully installed PyMySQL-0.9.2 asn1crypto-0.24.0 cffi-1.11.5 cryptography-2.3.1 idna-2.7 pycparser-2.18 six-1.11.0

OK.

相關推薦

CentOS7 安裝 Python3.7 SSL 編譯錯誤處理

下載: https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz 解包:tar -zxvf Python-3.7.0.tgz 進入 Python-3.7.0 目錄:     cd Python-3.7.0 1

Centos7安裝python3.7遇到的問題

一、安裝 1、安裝依賴環境 yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel

centos7 安裝python3.6 模塊安裝演示

更改 group sqli ins 修改 store get pen qlite 目錄: 下載python3.6 安裝python3.6的依賴 編譯安裝 更改鏈接 更改yum腳本的python依賴 修改gnome-weaktool配置文件 修改urlgrabber配置文件

centos7 安裝mysql5.7配置

一、Mysql 各個版本區別:1、MySQL Community Server 社群版本,開源免費,但不提供官方技術支援。2、MySQL Enterprise Edition 企業版本,需付費,可以試用30天。3、MySQL Cluster 叢集版,開源免費。可將幾個MySQL Server封裝成一個Se

Centos7安裝python3.7.1並與python2共存

轉自:http://www.cnblogs.com/JahanGu/p/7452527.html參考:https://www.jb51.net/article/104326.htm1. 備份原來的python版本。檢視是否已經安裝Python:[[email protected] ~]$ pytho

CentOS7安裝Python3.7

安裝環境 騰訊雲CentOS7 工具 putty 安裝依賴 yum install -y openssl-devel openssl-static zlib-devel lzma tk-devel xz-devel bzip2-devel ncurses-devel

CentOS7 安裝gcc 7.2 (為了編譯最新版ceph)

最新版本的ceph已經使用了c++14新特性,CentOS7中的gcc版本太低,所以需要手動安裝新版本的gcc。 本文給出了一個可以正確編譯ceph的gcc配置,供大家參考。 $ wget ht

Centos7 安裝Python3.7

sqli https epo fix libpcap config python ffi python2 # 更改yum源 cd /etc/yum.repos.d mv CentOS-Base.repo CentOS-Base.repo.bak wget -O CentO

Centos7 安裝python3.7.2

pes htm 安裝完成 centos 遇到 csdn ins 文件夾 name 下載python3.7.2源碼 wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz 下載完後對壓縮包解壓縮 t

centos7安裝python3.7和ipython

安裝python blank highlight 查看 div ade 有一個 修改 網址 一、centos7為剛安裝的 1)配置yum源和epel源 采用國內源   查看yum的配置文件 (裏面的鏡像網址)是否ping的通                     

centos7安裝python3.7.3

evel figure 安裝 b- bin entos tar pytho configure yum install gcc zlib zlib-devel libffi-devel -y wget https://www.python.org/ftp/python/

centos7.5下編譯安裝python3.7.0

安裝編譯工具和依賴庫 yum groupinstall "Development Tools" yum -y install wget openssl-devel bzip2-devel expat-devel ncurses-devel gdbm-devel readl

CentOS7安裝python3.6保留python2.7

python Linux CentOS pip python3.6環境搭建 安裝依賴 yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel g

Centos7 安裝Python3.6.5 安裝ipython 6.1.0

Python3.6.5安裝 Ipython6.1.0安裝 一、centos7 安裝 Python3.6.5教程1、在安裝Python之前,需要先安裝一些後面遇到的依賴問題(如果有依賴問題,按照提示安裝): yum -y install zlib-devel bzip2-devel openssl

centos7.5安裝python3.7

ipv6 path extension pre 系統環境變量 install fig 依賴包 lease 系統狀態 CentOS Linux release 7.5.1804 (Core) mini版安裝系統 Python-3.7.0.tgz 官方下載源碼包 安裝系統依

CentOS7.5從零安裝Python3.7

  ps:環境如標題 下載壓縮包 獲取下載連結 此處我們選取Python官網的Python3.7.0,下載地址如下 https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz   看官也可以自己選擇版本,官

Centos7二進位制安裝Mysql5.7以上版本

1.建立mysql使用者組和使用者 groupadd mysql useradd -r -g mysql -s /sbin/nolog mysql 2.下載mysql相關版本二進位制包,並解壓移動至/usr/local目錄 wget http://mirrors.163.com/mysq

Kali 2018.1編譯安裝Python3.7

1.1 下載Python-3.7原始碼包 [email protected]:/home# python -V Python 2.7.14+ [email protected]:/h

centos7.2安裝Python3.7

安裝依賴包 sudo yum -y groupinstall "Development tools" sudo yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-de

CentOS7安裝Hadoop2.7.3完整流程總結

一、前言 配置一臺master伺服器,兩臺(或多臺)slave伺服器; master可以無密碼SSH登入到slave; 解除安裝centos7自帶的openjdk,通過SecureCRT的rz命令上傳jdk-7u79-linux-x64.tar.gz檔案到伺