Schritte zum lokalen Installieren von Python 3 beim Beheben von OpenSSL-Fehlern ohne Administratorrechte.
$ 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"
Installationsziel erstellen
$ 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
Fügen Sie der Linkersuche lokales OpenSSL hinzu
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
Wenn dies angezeigt wird, ist es erfolgreich (Übrigens ist global openssl 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, wenn das SSL-Modul normal importiert werden kann
>>> exit()
$ pip37 install numpy
Überprüfen Sie auch, ob Pip verwendet werden kann
das ist alles.
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
Dies liegt auch daran, dass OpenSSL keine Verbindung zu Python herstellen kann. Überprüfen Sie die Installation von OpenSSL. Es sollte in Ordnung sein, wenn die Version mit "openssl version" korrekt angezeigt wird und das ssl-Modul mit dem Python-Interpreter importiert werden kann.
Recommended Posts