How to Install Python 3 in cPanel Server

Install python 3
Install python 3

Install Python 3 in cPanel Server

This blog explains how to install Python 3 in cPanel server. As you know, cPanel comes with Python 2.X as the mentioned version of Python is used for Mailman and Yum. Hence, we can’t upgrade the Python version as it may break the current cPanel setup.

In this post, I am describing how to install Python 3 alongside with the existing Python version in cPanel server. Therefore, you can use the tools which require Python 3 on your cPanel server.

As we are installing the latest Python from source, we need to install the development tools and the libraries for the proper functioning of the lastest Python version.

yum update
yum groupinstall "development tools"
yum install tk-devel gdbm-devel db4-devel libpcap-devel xz-devel expat-devel readline-devel lib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel libffi-devel

Once the prerequisites installed, we can go ahead and install Python 3

Install Python 3 from Source

Download the latest version of Python from here:

cd /usr/local/src
tar xzf Python-3.7.2.tgz
cd Python-*
./configure --prefix=/usr/local/python3.7 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make altinstall

Please make sure that you run make altinstall instead of make install. The make install command will break the existing Python installation.

To get Python 3.7 globally upon login, you need to update the library path like below:

Create a file

vim /etc/profile.d/

Add the following into it:

export PATH

Also, create another file opt-python3.6.conf

vim /etc/

Add the following into it:


Run the following commands to create the necessary links and cache to the most recent shared libraries found in the directories specified on the command line.

source /etc/profile.d/

It will complete the Python 3 setup and you can verify the both Python installation using the following commands:

Base Python installation:

python -V

Example Output:

[root@grepit ~]# python -V
Python 2.7.5
[root@grepit ~]#

Python 3.7 installation:

python3.7 -V

Example Output:

[root@grepit ~]# python3.7 -V
Python 3.7.2
[root@grepit ~]#

That’s it!

Also Read:

If you like the post Understanding top Command and wish to receive more articles from us, please like our FB page: GrepItOut

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at

1 Comment

Click here to post a comment