install specific version of python code example

Example 1: how to check python version

# To check your Python version in the command line use:
python --version

# To check your Python verson inside a script use:
import sys
print(sys.version)

Example 2: pip install specific version

# To install a specific version of a package using pip:
pip install Package_name==version

# Example:
pip install MySQL_python==1.2.2

Example 3: how to pip install a specific version

# At the time of writing this numpy is in version 1.19.x
# This statement below will install numpy version 1.18.1
python -m pip install numpy==1.18.1

Tags:

Misc Example