Getting Python 3.12 Up and Running on Ubuntu and Debian Servers

donfiealex
2 min readDec 9, 2023

--

To get Python 3.12 up and running on Ubuntu and Debian servers, there are several steps you can follow.

First, make sure your server is updated by running the following commands:

sudo apt update

sudo apt upgrade

Once the server is up to date, you can install Python 3.12 by using the deadsnakes PPA, which provides newer versions of Python for older Ubuntu releases. You can add the PPA and install Python 3.12 using the following commands:

sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt update

sudo apt install python3.12

After installing Python 3.12, you can verify the installation by checking the Python version:

python3.12 — version

To manage Python packages, it’s recommended to use pip, the package installer for Python. You can install pip for Python 3.12 using the following command:

sudo apt install python3.12-distutils

wget https://bootstrap.pypa.io/get-pip.py

sudo python3.12 get-pip.py

Now that Python 3.12 and pip are installed, you can start using Python on your server.

If you’re using Debian, you can also compile Python 3.12 from source. First, ensure that you have the necessary build tools and dependencies:

sudo apt install build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev

Next, for Install Python 3.12 on Ubuntu and Debian Server need to download the Python 3.12 source code, extract it, and navigate to the extracted directory. Then, you can configure, build, and install Python using the following commands:

./configure

make

sudo make install

After installation, verify Python 3.12 by running:

python3.12 — version

By following these steps, you can get Python 3.12 up and running on both Ubuntu and Debian servers. Happy coding!

--

--