On Ubuntu or compatible:
sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev zlib1g-dev libssl-dev libffi-dev lzma liblzma-dev
Download Python source and install as normal user with (replace prefix
path, e.g. /opt/py/python3.11
):
./configure --enable-optimizations --prefix=/opt/py/python3.11
make -j8 build_all
make altinstall
The argument -j8
is optional and makes the execution of the jobs in parallel. The user has to have write access into the folder specified, and if does not exist yet, have write access to the parent folder, otherwise the last command has to be executed as root
user.
Optional, create exec link at /usr/local/bin
with:
sudo ln -s /opt/py/python3.11/bin/python3.11 /usr/local/bin/python3.11
Optional dependencies regarding what is needed:
gettext
for Django.postgresql-common
andlibpq-dev
forpsycopg2-binary
.
Tested with Python 3.6, 3.8, 3.10 and 3.11. Based on answers found at https://askubuntu.com/questions/244544/how-do-i-install-python-3-3.