Skip to content

Script to install a newer version of Python on the Raspberry Pi

License

Notifications You must be signed in to change notification settings

big-jr/installpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

installpy

A script to build and install a newer version of Python on the Raspberry Pi and ARM64 Mac.

Why Use This Script?

There are two reasons to use this script:

  • It saves you a lot of typing when you want to update the version of Python on your Raspberry Pi, because you have to build it.
  • It handles the problem with zlib that you'll probably encounter during the build process, and then spend hours looking for on the web.

To Use The Script

Before you do anything else, if you're using a Raspberry Pi you'll need to install the zlib packages to handle the Zlib compression used in the Python source code:

sudo apt install zlib1g zliblg-dev

Copy the script to your home directory on your Raspberry Pi 3 or 4. Set the permissions on the script file so that you can execute it:

chmod u+x installpy.sh

Run the script passing the three-part version of the version of Python that you want to install.

For example:

./installpy.sh 3.10.11

Make sure you pass all three parts of the version number, or the script will fail.

Run it, go and have dinner, go to bed, go to sleep, get up in the morning and it'll probably be done. Admittedly I was using a Raspberry Pi 3!

Once the script has finished, you'll have a new version of Python to use on your machine. You'll need to address the new version directly, unless you add a symbolic link. I'll add more about that later - in the meantime you can check your new version of Python has installed by running this from the terminal:

python3.10 --version

which should display:

Python 3.10.11

I've Looked At This Script - It's Pretty Unrefined

Yes, it is. But it does the job. I'll be making it prettier later.

Where Can I Discover Some Background On This Script?

The original article this script was based on is on my blog: Installing a New Version of Python On A Raspberry Pi

Releases

No releases published

Packages

No packages published

Languages