Skip to content

Instantly share code, notes, and snippets.

@zebarnabe
Created April 1, 2022 19:52
Show Gist options
  • Save zebarnabe/396f79646dbe33084ee7f206f4cc7a59 to your computer and use it in GitHub Desktop.
Save zebarnabe/396f79646dbe33084ee7f206f4cc7a59 to your computer and use it in GitHub Desktop.
Build and install an old python
# Get and extract the tar and go to that directory
# Download source tarball into a subfolder named src, and untar:
# curl --create-dirs -L -o src/Python-2.7.18.tgz https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
# cd src
# tar -zxf Python-2.7.18.tgz
# cd Python-2.7.18
# In debian/ubuntu, otherwise we will have issues with ssl and pip...
# Reference (for mac and windows): https://stackoverflow.com/questions/45954528/pip-is-configured-with-locations-that-require-tls-ssl-however-the-ssl-module-in
sudo apt install libssl-dev
sudo apt install libncurses5-dev
sudo apt install libsqlite3-dev
sudo apt install libreadline-dev
sudo apt install libtk8.6
sudo apt install libgdm-dev
sudo apt install libdb4o-cil-dev
sudo apt install libpcap-dev
# if you need to run this again, run `make clean` before that
./configure --enable-optimizations
make
# Lets make the installation local
export DESTDIR="`pwd`/installation"
make install
# Get the environment ready
$DESTDIR/usr/local/bin/python -m ensurepip
$DESTDIR/usr/local/bin/pip install --upgrade setuptools pip
$DESTDIR/usr/local/bin/pip install --upgrade virtualenv
# create a virtualenv with python 2.7.18
$DESTDIR/usr/local/bin/python -m virtualenv venv
# Activate the virtualenv
source venv/bin/activate
# Deactivate the virtualenv
deactivate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment