Skip to content

Instantly share code, notes, and snippets.

@zoonderkins
Created August 14, 2023 09:50
Show Gist options
  • Save zoonderkins/bdca4cdec8f0b9f78e461c77eafc3d95 to your computer and use it in GitHub Desktop.
Save zoonderkins/bdca4cdec8f0b9f78e461c77eafc3d95 to your computer and use it in GitHub Desktop.
Ubuntu 18 make Python3.9

Why

As of Aug 14, 2023 deadsnakes ppa remove Ubuntu 18 bionic support for Python3.9 Therefore, We have to manually make it.

Installation

must be root user

py_version=3.9.17

apt install -y gcc make openssl libssl-dev zlib1g zlib1g-dev libffi-dev

cd /root

curl -O https://www.python.org/ftp/python/${py_version}/Python-${py_version}.tgz
tar -zxvf Python-${py_version}.tgz

cd Python-${py_version}

./configure --prefix=/usr/local/python/Python-${py_version} --with-ensurepip=install
make
make install

cd ..
rm -rf Python-${py_version} Python-${py_version}.tgz
ln -s /usr/local/python/Python-${py_version}/bin/* /usr/local/bin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment