Python is the most famous and most used programming language in the market, Python was used in many use cases, for example, machine learning...
Python is the most famous and most used programming language in the market, Python was used in many use cases, for example, machine learning, Artificial intelligence, modern web applications, etc...
In this article, we are going to install the python application on the Linux machine using yum repositories as well as using source code.
Most of the Linux flavor python default installed the version 2.6 or 2.7, below 3 python version going to end of their life, It is no longer supported package. So now we are going to install the python package 3.6 using yum and 3.7 using source code.
Installing python 3.6 Using yum:
Step1: Before installing the python update the dependencies files.
Command: yum update -y It will update the Available dependency package of updated versions.
Step2: Install the python package for version 3.6
Command: yum install -y python36-setuptools python36-devel
Now the python version 3.6 was successfully installed, but if we checked using the command python --version it shows the default python version 2.7.
Command: python --version
If we check the python3 installed version. Command: python3 --version
Default, if search python version shows 2.7, so need to change into 3.6.
Now give the below command to change the default version to 3.6.
Command: alternatives --set python /usr/bin/python3.6
Once given the above command needs check using the below command.
Command: alternatives --display python
We can modify the default Python version using the same method.
Open the .bashrc file in the user directory here root directory (~), and update the alias functionality.
Add the new alias to change the default executable.
Command: vi .bashrc
Add the line: alias python='/usr/bin/python3.4'
Relogin the source using the command:. ~/.bashrc
Now check the Python version itself it shows the version.
Command: Python --version
Installed the dependency packages for installing the Python using source code.
Command: yum install gcc openssl-devel bzip2-devel libffi-devel
Change the directory and download the python3.7 source code.
Commands: cd /opt
wget https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz
Untar the downloaded file.
Command: sudo tar xzf Python-3.7.9.tgz
Change the directory and compile the sour code.
Commands: cd Python-3.7.9
sudo ./configure --enable-optimizations
The below command is used to install the second version of Python packages.
sudo make altinstall
Once compiled and installation completed without any errors we can check the python version using the below command.
Command: Python --versionDownload the Python script to install the pip
Command: curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Run the downloaded python file
command: python get-pip.py
Now installed the pip :
command: easy_install-3.6 pip
Once the pip3 is installed we can install the Python modules on it.
Now we are going to install the quick fix using the pip3
Command: pip3 install quickfix
Finally, we have installed Python 3.6, and 3.7 using the yum and source code. Installed the pip3 tested to Install the python module on it.