to select ↑↓ to navigate
Developer Guides

Developer Guides

Open in ChatGPT
Ask ChatGPT about this page
Open in Claude
Ask Claude about this page

How to install Python 2.7 on Ubuntu 24.04 LTS

Ref: How to install Python 2.7 on Ubuntu 24.04 Noble LTS Linux

Update System Packages

sudo apt update && sudo apt dist-upgrade

Install Dependencies

Install some essential developers tools.

sudo apt install -y build-essential checkinstall libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev

Install libssl1.1 as it required to compile python2.7:

curl -O http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb
#Download the Python 2.7 source code
$ wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
#Extrect the tarball
$ tar -xvf Python-2.7.18.tgz
#Compile and install Python 2.7 on Ubuntu 24.04
$ cd Python-2.7.18
$ ./configure --enable-optimizations
#Compile
$ make
#BEWARE: compile with -i (ignore receipt error flag) if error occured
$ make -i
#Install
$ sudo make install
#Verify the installation
$ python -V
#Setting Up pip for Python 2.7
$ sudo apt install curl
$ curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
$ sudo python2.7 get-pip.py
# Verify the pip installation
$ pip2.7 --version

TODO: to complete this guide. it's still showing error on compilation on Ubuntu Deskto 24.04.

Last updated 2 months ago
Was this helpful?
Thanks!