Here’s a step-by-step tutorial on how to set up your Python development environment.
Distribution and Compiler
The first step is to install Anaconda. Click here, select the appropriate version for your machine and operating system, download the .dmg file, open it and double-click the installer.
Make sure that when the installer asks where to put the distribution, you choose your actual hard drive and not some sub-directory on your machine. This will make things much easier later on.
Next you’ll need a C compiler. If you’re using MacOSX, I recommend using Xcode which you can download free here. (This step may take a while so go get a beverage.) Once the download is complete, run the installer.
For future installation of packages, I recommend using Pip. To install this, at your Terminal command line type
sudo easy_install pip. Then whenever you want to install a package you might need, you just open Terminal and do
pip install package_name.
Not every package is this easy (though most are). If you can’t get something through Pip just download, unzip and put the folder of your new module with the rest of your packages in the directory /anaconda/pkgs/.
Then in Terminal, navigate to that directory with
cd /anaconda/pkgs/package_dir_name and do
python setup.py install.
MacOSX comes with the text editing application TextEdit but it is not good for editing code. I strongly recommend using TextMate though it is not free so you should ask your advisor to buy a license for you! Otherwise, some folks find the free TextWrangler to be pretty good.
Next, you’ll want to get access to the BDNYC database. Detailed instructions are here on how to setup Dropbox and Github on your machine in order to interact with the database.
Now to use Python, in Terminal just type
ipython --pylab. I recommend always launching Python this way to have the plotting library preloaded.