Mac Swampy (Python learning module) install

I thought I would teach my kids programming and am using "Think Python" by Downey. The book is great except when he gets to installing "Swampy" a Turtle-like learning module. I've spent a few hours trying to figure it out--now I need help.

Can anyone offer a clear, step-by-step set of instructions on how to install Swampy? Please assume zero prior knowledge of Unix, etc.

I'm on OS X (10.6.6). Python is running fine. Tkinter is fine.

Here are the overall installation instructions offered at the author's site:

I am stuck at the "Add Swampy to your search path" section.

Here are the additional instructions the author points to regarding the search path:

Probably terribly obvious buy tough stuff for an intro text!


A few details for the record for anyone who comes across this later:

  1. My installation does not have a file or folder "python2" so the pathname "/home/downey/swampy-2.0/python2" might not work. I just dropped the "python2" and all was well.

  2. Had a bit of a problem finding the bashpc or bash_profile file. Didn't seem to exist even when looking for hidden files. So I just created a new one. All seems well.

Thanks again for your help--I would never have figured it out :)

I'm surprised there isn't some sort of installer or script to handle this given the audience for the book (newbies like me). :)


Open the terminal and navigate to the folder where you unzipped Swampy. Find the full directory path of that location by typing pwd. Let's say that location is /home/downey/swampy-2.0/python2. Now in the terminal issue this command export PYHTONPATH="/home/downey/swampy-2.0/python2". This will set the PYTHONPATH environment variable.

If that works fine, you need to make sure that this always runs when you open the terminal. For that you need to edit a file called .bashrc on your computer.

In the terminal, try nano ~/.bashrc.

That will open a simple text editor. In that file add the same line export PYHTONPATH="/home/downey/swampy-2.0/python2". Type Ctrl+X to close and make sure you save.

Now instead of always setting the environment variable manually, you can just do source ~/.bashrc and that will execute the command for you.

Note that every time you exit and reopen the terminal, you need to run source ~/.bashrc for the PYTHONPATH to be set.If you don’t want to run source ~/.bashrc every time you open the terminal, you can configure the Terminal to automatically run this command at startup (i.e. when the terminal window is opened). To do that –

  • Go to Terminal –> Preferences –> Settings –> Shell.
  • Check ‘Run Command’ and enter source ~/.bashrc.
  • NOTE: These settings are only need to be applied to each profile separately. For example if you applied these settings to the Basic profile, they won’t be applicable to Grass profile.

Hope this helps!

An easy way to add variables to your path is to add them to your .bash_profile, which is located in your home directory. This file loads every time you open up terminal. It is a hidden file, so you will not be able to view it (by default) in Finder. Run this command after opening a new terminal window:

open -a TextEdit .bash_profile

This will open the profile up in a new TextEdit window. Add this & save:


Assuming your Swampy download path is the same from the Web Site (/home/downey/swampy-2.0/python2), the next time you run terminal, the path should now be included.

Need Your Help

comma separated list regex

javascript jquery regex comma

how to make a jquery regex to detect comma separated list.

Different results when applying function to equal values

haskell tuples equality

I'm just digging a bit into Haskell and I started by trying to compute the Phi-Coefficient of two words in a text. However, I ran into some very strange behaviour that I cannot explain.