To check if you have
python3 installed in CentOS 7 (which by default is not possible, as the latest version delivered is 2.7.5) you can run the command:
This will give you an error and says that you should try the python command, and this command will show you the python 2.7.5 result.
We will install the latest stable version of Python 3 in CentOS 7. This version, at the time of writing is 3.6.4.
First, run the following commands:
And then make sure to have all the dependencies needed (like GCC and others) by running the commands:
Now we will download python 3.6.4 from the following address and we will save it inside
Now we will extract the package with the command:
After the package has been decompressed, go to the directory with the command:
And then install Python 3.6.4 with the following command:
To install this version of Python, you will need to use the
make altinstall command, in order to overcome problems that would be generated if you use the usual make install command.
After that create a symbolic link from the python3.6 file to the /usr/bin/python3 command (python3.6 command already exists inside /usr/bin and you can use it, but I thought that python3 is more appropriate):
To check the installation, run the command:
This will output something like the following:
You can also run the
python3.6 command, and you will get the same result as with
This means that your Python 3 has been installed.
After you install Python 3, you will need to install some Python libraries, needed for development. Those extra packages will be installed from the
IUS repository, as shown previously in a different article. For this, we need the
python36u-devel package. Also, we will install
pip the utilitary that you will use to install specific python packages.
You can also install the
To start the Python IDLE for Python 3.6, just run the command:
The IDLE environment in CentOS7