Install Zelle’s Python Library For Mac

zelle-python-book-cover

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

http://mcsp.wartburg.edu/zelle/python/

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

python3 --version

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.

import graphics

IDLE should return

>>>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s