Skip to content

Instantly share code, notes, and snippets.

@Zacharyprime
Forked from xslendix/python-3.6-pi.sh
Created July 14, 2021 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zacharyprime/702d798340c0906d70a446f0a1b189d6 to your computer and use it in GitHub Desktop.
Save Zacharyprime/702d798340c0906d70a446f0a1b189d6 to your computer and use it in GitHub Desktop.
Install python 3.6 on your RPi!
sudo apt-get update
sudo apt-get 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
wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tar.xz
tar xf Python-3.6.0.tar.xz
cd Python-3.6.0
./configure
make
sudo make altinstall
echo "Do you wish to delete the source code and uninstall all previously installed packages? {Y/N} (Case sensitive!)"
read ans
if [ans = "Y"]
then
sudo rm -r Python-3.6.0
rm Python-3.6.0.tgz
sudo apt-get --purge remove build-essential tk-dev
sudo apt-get --purge remove libncurses5-dev libncursesw5-dev libreadline6-dev
sudo apt-get --purge remove libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev
sudo apt-get --purge remove libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev
sudo apt-get autoremove
sudo apt-get clean
else
echo "Done!"
fi
@Zacharyprime
Copy link
Author

Zacharyprime commented Jul 14, 2021

After running this (I answered no to the prompt but it shouldn't matter, I just wanted to keep some of the stuff in there)
I did:

sudo apt-get --purge remove python3.4
sudo apt-get --purge remove python3
ln /usr/bin/python3 /usr/local/bin/python3.6

Then after these are finished, you can check that it get the right version with:

python3 -V

Then pip needs to be updated with:

sudo python3 -m pip install --upgrade pip setuptools wheel

Then I went and installed Jupyter with the new pip install, currently crossing my fingers hoping it works as I'm writing this

@xslendix
Copy link

You could add the replacement step as an optional step then update pip with /usr/local/bin/python3.6 -m pip .... Also would remove build-essential but idk that's up to you

@xslendix
Copy link

Great job!

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