Last active
April 22, 2018 08:10
-
-
Save gschizas/45fc0ccdbca82fb001cbf97d81e4931e to your computer and use it in GitHub Desktop.
Install Python from Source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
set -o errexit | |
set -o nounset | |
ver=$(curl https://api.github.com/repos/python/cpython/tags | jq -r 'first(.[].name | select(test("v\\d\\.\\d+\\.\\d+$")))[1:]') | |
ver2=$(echo $ver|cut -c1-3) | |
sudo apt install -y build-essential git jq libbz2-dev libc6-dev libffi-dev libgdbm-dev liblzma-dev libncurses5 libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev openssl tk-dev zlib1g-dev | |
curl --insecure --remote-name https://www.python.org/ftp/python/$ver/Python-$ver.tgz | |
tar xzf ./Python-$ver.tgz | |
cd Python-$ver | |
./configure --enable-optimizations | |
make -j4 | |
sudo -H -E make install | |
pip$ver2 install --upgrade pip | |
pip$ver2 list -o --format=json | jq -r '.[].name' | sudo -H -E xargs pip$ver2 install -U |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment