We have been asked about installing Python on CentOS Linux servers, and here is how to do that.
The installation instructions are based on our CentOS Linux installation and on the instructions for installing the package for CentOS Linux.
We have found that a lot of information in the documentation on CentOS for CentOS is very useful for those who want to get started.
It also helps us understand what we need to do to install and configure the Python packages.
This article will not cover the installation of Python itself, but rather the installation, configuration and administration of the Python package for Linux.
Installation and Configuration¶ If you are using CentOS Linux and you want to install the Python 3 packages on your CentOS Linux server, you can download the installer from the following link.
The installer will ask you to install each package by typing the following command: apt-get install python-dev python-python3-pip python-virtualenv pip install python3-dbus pip install pylons-dev If you use the CentOS Linux web server, and you have the Python-3-py2 package installed, then you can simply go to your web server and type: pip install py2-dev Alternatively, if you have Python installed locally and you are not running CentOS, you may need to run the following commands in a terminal: pip uninstall python-py3-dev Note If you do not already have Python, then either run: pip reinstall py3-devel pip install -r requirements.txt If you already have the python package installed locally, you will need to restart your web host.
This will create a new environment in which you can install the package.
You may want to use a different web host for the Python packaging.
To do this, type: aptitude restart web host This will reboot your host.
If you want the package to be available on the local web host, then run: python3 web host Note If there are other packages available, then this may take some time, so make sure you install them before you restart your host to make sure they are available.
If all goes well, the package will now be available in the web host and you can start it from that web host by typing: python web host In the next example, we are installing the Python 2 packages.
The web host will not install the Py2 packages, so you will have to use the Python Package Index (CPI) package instead.
To install the python2-dejavu package, we will use the command pip install –upgrade pip install djavu If you have a CentOS server running, and it is not listed as a default server, then use the following steps to install it.
You will need the py2 package, the pip package and the pip install package.
Type: pip3 install pypy2-djavu To install pip3: pip pip3 uninstall pip pip pip uninstall pip3-repository pip3 Install pip3 pip3 and install djaven-repo You can now restart your hosting system.
If the packages are installed, you should see pip2 running on your web hosting system, and pypy in your local system.
This should now be a Python 2 web host with a py2 web host interface, and pip2 and pip3 installed in it.
If not, please refer to the documentation for installing Python 2.x on CentOS.