-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Installing Python
All the labs and assignments in this course are Python-based. This page provides information about configuring Python on your machine.
Step 0 The IPython notebook runs in the browser, and works best in Google Chrome. You probably want to use Chrome for assignments in this course
The Anaconda Python distribution is an easily-installable bundle of Python and many of the libraries used throughout this class. Unless you have a good reason not to, we recommend that you use Anaconda.
- Download the appropriate version of Anaconda
- Follow the instructions on that page to run the installer
- Edit your
.bashrc
, or.profile
file in your home directory to add the following lines:
export PATH="$HOME/anaconda/bin:$PATH"
unset PYTHONPATH
- Test it out: open a terminal window, and type
python
, you should see something like
Python 2.7.5 |Anaconda 1.6.1 (x86_64)| (default, Jun 28 2013, 22:20:13)
If Anaconda
doesn't appear on the first line, you are using a different version of Python. Make sure that you correctly set the PATH in the previous step (which python
should return the version of Python in the anaconda folder)
- Test out the IPython notebook: open a Terminal window, and type
ipython notebook
. A new browser window should pop up. - Click
New Notebook
to create a new notebook file - Update IPython to the newest version by typing
conda update ipython
at the command line
- Download the appropriate version of Anaconda
- Follow the instructions on that page to run the installer. This will create a directory at
C:\Anaconda
- Test it out: start the Anaconda launcher, which you can find in
C:\Anaconda
or, in the Start menu. Start the IPython notebook. A new browser window should open. - Click
New Notebook
, which should open a new page. - Update IPython to the newest version by opening a command prompt, and typing
conda update ipython
Anaconda includes most of the libraries we will use in this course, but you will need to install a few extra ones:
The recommended way to install these packages is to run pip install BeautifulSoup MrJob
on the command line. If this doesn't work, you can download the source code, and run python setup.py install
from the source code directory. On Unix machines, either of these commands may require sudo
(i.e. sudo pip install...
or sudo python
)
To view an IPython notebook, you must first start the IPython notebook server in the directory where the file lives. Simply navigate to this directory at the command prompt, and type ipython notebook
. This will open a browser window, listing all the ipynb
files in that directory.