Python is a high-level, object-oriented and multipurpose programming language that is extremely popular thanks to its simple and easy-to-learn syntax. It is widely used in various IT disciplines such as data analytics and visualization, web development, gaming development, AI, and machine learning.
Run the below command to update the system and install the required dependencies for the python 3.10.
apt upgrade apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev
At the time of writing this article, the latest version of 3.10 is version 3.10.11. We recommend you check Python's official site to get the latest version for your installation, https://www.python.org/downloads/
wget https://www.python.org/ftp/python/3.10.11/Python-3.10.11.tgz tar -xvf Python-3.10.11.tgz
If a different version has been downloaded, ensure you extract the correct file.
cd into the extracted directory, in our case it is
Python-3.10.11 (the name may vary if a different version has been downloaded).
And run the
configure command to verify if all the dependencies are met for the Python installation.
cd Python-3.10.11 ./configure --enable-optimizations
Let's get the number of CPU cores your machine has,
This will print a number, use that in the below command,
make will start the build process and the number 4 represents the number of CPU cores.
make -j 4
Make install The default Python installation is /usr/bin. If you want to install Python under /usr/local/bin instead of overwriting the default, do this:
Run the below command to get the version of the installed Python:
root@vps:~/Python-3.10.11# python3.10 --version Python 3.10.11
This concludes our topic of installing Python 3.10 version.