Python is an object-oriented, high-level, interpreted programming language. Although, Python 3.7.3 comes installed by default in Ubuntu 19.04. But, there could be circumstances wherein users may have to install the latest stable package manually. At the time of writing the article, the latest stable version for Python is 3.7.4. It was released on July 08, 2019. In this article, we would discuss how to install Python 3.7.4 in Ubuntu 19.04.
Furthermore, for users who would want to know which Python version is installed in their Ubuntu distribution may issue the following in terminal –
python3 -V
This should return with the output in Ubuntu 19.04-
Python 3.7.3
Ubuntu distributions do have the latest stable version of Python available at the time of release. So, in case of Ubuntu 19.10 you would get the latest stable version of Python i.e. Python 3.7.4+.
Note: Following operations would require you to have superuser privileges. In case you don’t have one, then contact your System Administrator for assistance.
Install Python 3.7.4 in Ubuntu 19.04
To install Python 3.7.4 in Ubuntu 19.04, you need to download the relevant file from the Python’s official website. Head to the Downloads section and Press the Download Python 3.7.4 button.
The package size is of 16.3 MBs and time taken to download would depend on your network connection speed.
Thereafter, we would extract the downloaded file Python-3.7.4.tar.xz through command-line utility tar. Therefore, issue the following in terminal –
tar -xvf Python-3.7.4.tar.xz
This creates a folder Python-3.7.4 in the same directory where Python-3.7.4.tar.xz was downloaded.
Get inside the directory through cd command-line utility –
cd Python-3.7.4
and, run following commands in terminal –
./configure make make test
You got two options at this point, either to keep the installed version of Python and install latest version alongside it or overwrite the existing version.
To Overwrite the existing version of Python –
sudo make install
To Keep the installed version of Python and install the latest stable version alongside it –
sudo make altinstall
During the installation process, you may encounter following errors –
Error 1.
zipimport.ZipImportError: can't decompress data; zlib not available make: *** [Makefile:1132: install] Error 1
Solution. Install the relevant package –
sudo apt install zlib1g-dev
Error 2.
ModuleNotFoundError: No module named '_ctypes' make: *** [Makefile:1132: install] Error 1
Solution. Install the relevant package –
sudo apt install libffi-dev
This will successfully install the latest stable version of Python. To check for the version installed, open a new terminal –
python3.7 -V python3.7m -V
It should return with the latest version of Python installed.
Python 3.7.4
In conclusion, we have discussed how to install the latest stable version of Python i.e. Python 3.7.4 in Ubuntu 19.04