I have several versions of python my Ubuntu machine. The default is 2.7. However, I could manage to run python 3.6 by going to a specific path which is:
/usr/local/bin/code/tls-client
I need to use openSSL
library in my python code. I want to run specific version: 1.1.0
. I tried to use pip install openssl
then check if the version got updated, but it is not.
python3
Python 3.6.5 (default, May 3 2018, 10:08:28)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> ssl.OPENSSL_VERSION
'OpenSSL 1.0.2g 1 Mar 2016'
How can I link python 3.6.5 to a specific version of openSSL (say OpenSSL 1.1.0)? or even 1.1.1 (if possible)?
EDIT: After compiling it from the source as the answer suggests, I checked the verison and this is what I get:
/usr/local/bin/openssl-1.1.0h$ openssl version -a
OpenSSL 1.0.2g 1 Mar 2016
built on: reproducible build, date unspecified
platform: debian-amd64
options: bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx)
compiler: cc -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
OPENSSLDIR: "/usr/lib/ssl"
Assuming you haven't updated to the most recent stable version of OpenSSL
(from bash console):
$ sudo apt update && sudo apt upgrade openssl
If that doesn't install the version you expect (check by doing openssl version -a
), then try compiling it and installing manually:
wget https://www.openssl.org/source/openssl-1.1.0h.tar.gz
tar xzvf openssl-1.1.0h.tar.gz
cd openssl-1.1.0h
./config -Wl,--enable-new-dtags,-rpath,'$(LIBRPATH)'
make
make install
openssl version -a
should update OpenSSL
to version 1.1.0h
— linking should be handled automatically.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.