Last active
July 15, 2021 17:34
-
-
Save slendidev/fcb55ae06b49be557e3418cfa8af4534 to your computer and use it in GitHub Desktop.
Install python 3.6 on your RPi!
This file contains hidden or 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/bash | |
putsc() { | |
echo -en "\e[34m :: \e[0m $@" | |
} | |
putscl() { | |
putsc "$@\n" | |
} | |
cores="$(ncores)" | |
putscl "Which Python version do you wish to download? (3.6.0, 3.6.4 etc.) " | |
read version | |
putscl Updating system. | |
sudo apt update | |
sudo apt upgrade | |
putscl Installing required build dependencies. | |
sudo apt install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev -y | |
putscl Downloading Python $version source code. | |
pushd | |
mkdir -p $HOME/.local/src | |
cd $HOME/.local/src | |
wget https://www.python.org/ftp/python/$version/Python-$version.tar.xz | |
tar xvf Python-$version.tar.xz | |
cd Python-$version | |
putscl Configuring. | |
./configure | |
putscl Compiling. | |
make -j$cores | |
putscl Installing. | |
sudo make altinstall | |
putsc "Installation done! Do you wish to delete the source code? [Y/n] " | |
read ans | |
if [[ ans == [Yy]* ]] | |
then | |
sudo rm -r Python-$version | |
rm Python-$version.tar.xz | |
sudo apt autoremove | |
sudo apt clean | |
fi | |
popd | |
putscl "Done! Python should now be installed in `/usr/local/bin/python$version`!" |
I get your point, I don't understand why previous me had that in the script, maybe to remove bloat if you dont need it? Doesn't matter though since you can just say N
Updated the script to make the output nicer and fixed some bugs.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
build-essential is used for gcc, make, header files and other stuff required for development. Here it's used to compile py 3.6.0