Maybe it’s just me, but installing the graphics library that’s needed to go through the exercises in John Zelle’s book Python Programming: An Introduction to Computer Science was a lot more difficult than it should have been. Difficult enough that this post is probably more for me than it is for anyone else, but if you’re having trouble installing the graphics library on a Mac, here is how I did it.
First visit the site mentioned in the Appendix of Zelle’s book
Somewhere towards the middle of the page find the graphics.py link, right click it, and copy and paste that into your python project folder (the project your doing your exercises for the book).
Now open up your terminal and run these commands
In my case the terminal returns python 3.5.1
You only need to remember up to tenth decimal place so in my case that’s 3.5. Next you’re going to type this command into the terminal but make sure to replace the two version numbers with the version number of python on your computer
open -a Finder /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/
This command will open up the correct folder that you will need to put your graphics.py file in. So, copy the graphics.py from the python project folder and paste it in the folder you just opened up.
To test and make sure you’ve installed graphics.py correctly open up IDLE, and type.
IDLE should return