Étapes pour installer Python 3 localement tout en résolvant les erreurs OpenSSL sans privilèges d'administrateur.
$ cat /etc/issue
Ubuntu 14.04.6 LTS \n \l
$ cd /home/user/src
$ wget https://www.openssl.org/source/openssl-1.1.1h.tar.gz
$ wget https://prdownloads.sourceforge.net/tcl/tcl8.6.10-src.tar.gz
$ wget https://prdownloads.sourceforge.net/tcl/tk8.6.10-src.tar.gz
$ wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tar.xz
/home/user/.bash_profile
alias targz="tar xzvf"
alias tarxz="tar xvf"
Créer une destination d'installation
$ mkdir /home/user/local/ssl
$ mkdir /home/user/local/ssl/1_1_1h
Installation
$ cd /home/user/src
$ targz openssl-1.1.1h.tar.gz
$ cd openssl-1.1.1h
$ ./config --prefix=/home/user/local/ssl/1_1_1h --openssldir=/home/user/local/ssl shared
$ make
$ make install
/home/user/.bash_profile
Ajouter OpenSSL local à la recherche de l'éditeur de liens
LD_LIBRARY_PATH=/home/user/local/ssl/1_1_1h/lib:$LD_LIBRARY_PATH
alias /home/user/local/ssl/1_1_1h/bin/openssl
$ openssl version
OpenSSL 1.1.1h 22 Sep 2020
Si cela est affiché, cela réussit (au fait, global openssl vaut 1.0.2)
/home/user/.bash_profile
$ function pyconf (){
./configure --prefix=/home/user/local/$1 --with-ensurepip --with-openssl=/home/user/local/ssl/1_1_1h \
--with-tcltk-includes="home/user/local/include" --with-tcltk-libs="/home/user/local/lib -ltcl8.6 -ltk8.6"
}
$ mkdir /home/user/local/python379
$ cd /home/user/src
$ pyconf python379
$ make
$ make install
/home/user/.bash_profile
alias python37="$HOME/local/python379/bin/python3.7"
alias pip37="$HOME/local/python379/bin/pip3.7"
$ python37
Python 3.7.9 (default, Nov 2 2020, 16:54:48)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>>
OK si le module ssl peut être importé normalement
>>> exit()
$ pip37 install numpy
Vérifiez également si pip peut être utilisé
c'est tout.
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: 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/numpy/
WARNING: 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/numpy/
WARNING: 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/numpy/
WARNING: 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/numpy/
WARNING: 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/numpy/
Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement numpy (from versions: none)
ERROR: No matching distribution found for numpy
WARNING: 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
Eh bien, cela est également dû au fait qu'OpenSSL ne peut pas se lier à Python. Examinez l'installation d'OpenSSL. Cela devrait être correct si la version est affichée correctement avec "openssl version", et d'ailleurs, le module ssl peut être importé avec l'interpréteur python.
Recommended Posts