gogoWebsite

Python 3.12 version installed by Ubuntu

Updated to 19 hours ago

Stable version 3.12.0 can be installed from source code execution.

To install Python 3.12.0, run the following command:

# wget /ftp/python/3.12.0/Python-3.12.
# tar -xvf Python-3.12.
# cd Python-3.12.0
# ./configure
# make
# make install

If an error occurs:
can’t decompress data; zlib not available
Explain the lack of dependency: zlib.

# Install dependencies on zlib and zlib-devel
 # In ubuntu, zlib is called zlib1g, and the corresponding zlib-devel is called zlib1g-dev
 $ sudo apt-get install zlib1g
 $ sudo apt-get install zlib1g-dev

When the installation is complete, use it to verify the location of the main binary:

# which python3
# python3 -V

If it is not the latest 3.12, restart the system.

Check Python 3 version in Linux

# python3

quit()
or
exit()
And press Enter.

Congratulations! Python 3.12 is now installed on your system.

When executing pip install, it appears:
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Required to install:

$ sudo apt-get install openssl
$ sudo apt-get install libssl-dev
$ sudo ./configure
$ sudo make && make install

Replace python2.7 with python3.12

sudo ln -s /usr/local/bin/python3.12 /usr/bin/python