This guide explains how to install Python 3 for VPS+. This version is a standalone installation separate from the cPanel installed Python version.
Installing Python 3
CAUTION: This guide will outline the installation of Python 3. Please note that this is a side installation and will be available via the python3 command, as replacing Python will cause many default features of the server and cPanel to no longer function.
IMPORTANT: This solution will require root access. If this needs obtained, follow the guide on requesting root access.
- SSH into the server as root
- Run the following to install a stand-alone copy of Python3 to the server
IMPORTANT: These steps are for Python 3.7.3. If a different version is needed, update the applicable steps below with the correct version.cd /usr/src wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz tar -xvf Python-3.7.3.tgz cd Python-3.7.3 ./configure --prefix=/usr/local make
make
may display an error regarding a missing '_ctypes' moduleModuleNotFoundError: No module named '_ctypes' make: *** [install] Error 1
Failed to build these modules:
_ctypes- If so, use the following command to install the required libffi-devel package
yum -y install libffi-devel
- Run
make
again
- If so, use the following command to install the required libffi-devel package
- Run
make install
to finish installing Python 3 - Python3 can now be run or called with the python3 command. Any scripts needing to run on this alternate version will use
#!/usr/local/bin/python3
- Check the version and location of Python3 by running the below commands
# python3 -V Python 3.7.3 # which python3 /usr/local/bin/python3
Comments
0 comments
Article is closed for comments.