Virtual environment With Compiled python and openssl
In this tutorial we are using python 3.6.8 and openssl openssl-1.1.1d
install the dependencies
$ sudo yum -y groupinstall development
$ sudo yum -y install zlib-devel
$ sudo yum -y install openssl-devel
compile openssl into directory
create a directory
$ mkdir opt
$ cd opt
$ wget https://www.openssl.org/source/openssl-1.1.1d.tar.gz
$ tar -xzf openssl-1.1.1d.tar.gz
$ cd openssl-1.1.1d
$ ./config --prefix=/home/testuser/opt/openssl where you want to install
$ make
$ make install
Compiled opennsl in compiled python 3.6.8
dowbload python from https://www.python.org/
$ wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
$ tar -xvzf Python-3.6.8.tgz
$ cd Python-3.6.8
$ vim Modules/Setup.dist
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL= /home/testuser/opt/openssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
$ mkdir python_home
$ ./configure --enable-optimizations --with-ensurepip=install --prefix="$HOME"/python_home
$ make
$ make install
$ cd ~/app
$ virtualenv --python ~/python_home/bin/python3.6 .venv
$ source .venv/bin/activate
(.venv)$ python -V
Python 3.6.8

0 Comments