Python and its Packages Version Management

python
https://miro.medium.com/max/1400/0*8aY8pX5CoNGImZU4.png

Overview

Assumptions

Pre-Requisites

Guidelines

$ sudo yum -y install gcc zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel 
$ tar xJf <file-name>.tar.xz 
$ cd <file-name>.tar.xz
$ ./configure
$ make
$ sudo make altinstall # if a version is already installed other remove the "alt" and just run install
$ python3 -version
pythonX.X
pythonX.Xm
pythonX.Xm-config
sudo python<version> -m pip install <package-name>
/usr/local/lib/pythonX.X/site-packages
# To create a virtual environment using venv
$ python3 -m venv ENV_NAME
# To activate it
$ source ENV_NAME/bin/activate
# To deactivate it
$ deactivate
# To install virtualenv
$ sudo pip3 install virtualenv
# if it is not available on cli check if it exists in /usr/bin. If not check the /usr/local/bin directory and move it to /usr/bin.# To create a virtual environment using virtualenv
$ python3 -m venv ENV_NAME
# To activate it
$ source ENV_NAME/bin/activate
# To deactivate it
$ deactivate
$ pythonX -m IPython

Final Thoughts

DevSecOps Engineer https://irtizaali.com/