Skip to content

Instantly share code, notes, and snippets.

@nikhiljohn10
Last active July 28, 2022 12:16
Show Gist options
  • Select an option

  • Save nikhiljohn10/248577ddd0b26061bcd24ebb5b3e0354 to your computer and use it in GitHub Desktop.

Select an option

Save nikhiljohn10/248577ddd0b26061bcd24ebb5b3e0354 to your computer and use it in GitHub Desktop.
Python 3.10.5 Build Script for Ubuntu
#!/usr/bin/env bash
LOCAL_USER=$(whoami)
PREFIX="/home/$LOCAL_USER/.local"
SOURCE="$PREFIX/src"
BINARY="$PREFIX/bin"
sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y
sudo apt-get install -y build-essential gdb lcov pkg-config \
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \
lzma lzma-dev tk-dev uuid-dev zlib1g-dev git wget make
mkdir -p $SOURCE && cd $SOURCE || exit
wget https://www.python.org/ftp/python/3.10.5/Python-3.10.5.tgz
tar xzf Python-3.10.5.tgz
rm $SOURCE/Python-3.10.5.tgz
cd $SOURCE/Python-3.10.5/
./configure --prefix $PREFIX --enable-optimizations
make altinstall
sudo ln -s $BINARY/python3.10 /usr/bin/python
sudo ln -s $BINARY/pip3.10 /usr/bin/pip
pip install -U pip virtualenv
python -V
pip -V
@nikhiljohn10
Copy link
Author

Use the following command to run the above script in ubuntu

sudo apt update && sudo apt install -y wget
wget py3.infamousimps.xyz/build.3.10.5.sh
bash build.3.10.5.sh

If the above code result in an error, try the code below:

sudo apt update && sudo apt install -y wget
wget https://gist.githubusercontent.com/nikhiljohn10/248577ddd0b26061bcd24ebb5b3e0354/raw/65c43779fc4a4e2c88984735001f97331ed2a362/build_python_ubuntu.sh
bash build.3.10.5.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment