How to install Python and run my class stuff on my laptop

How to install Python and emacs and run class stuff on my laptop

This is updated from the "How to install emacs and run my class stuff on my Mac" document.

1. Installing Python

If you are on a Mac, you probably already have Python installed. If that's the case, I'd suggest you continue to use that version. The downloaded version of Python seems to be a bit flakey.

For PC users: you will have to download Python and install it. We are using the 2.7 version of Python in the lab, but version 2.8 also works fine. Just don't get Python 3 -- that one is quite substantively different!

Come here to download Python: https://www.python.org/download/releases/2.7.8/. Get the "Windows x86 MSI Installer" and run it.

2. Installing an editor

Python comes with its own editor, called IDLE. If you are on a PC, you will see it in the "Python27" folder in the "Start" menu. That's actually a pretty good editor and I would recommend using it. The only problem with it is that it tends to give too many hints (it will tell you, for example, what kinds of parameters are needed for a function as soon as you type in the function name). But if you don't get so dependent on it, then it's a pretty good editor to use.

Unfortunately, IDLE on the Mac is a little unstable, especially when combined with the graphics stuff. For Mac people, I'd recommend downloading emacs. I use this version:
http://emacsformacosx.com/
It's close to the version that we use in class -- not identical, but close enough.

However, note that if you use this, you cannot run emacs by calling it in the terminal like sometimes you see your classmates do in class. You will have to launch emacs like any other application, and then browse through your directories to look for your file (just like I showed you in class.)

Emacs in windows is painful. If you figure out how to do that and can send me a writeup, I'll link to it.

3. Installing graphics

If you want to run the Python graphics programs at home, you will need to download the graphics library that we have been using:
graphics.py (Right click to download to your hard drive.)

When it's done downloading, then you need to move it to somewhere that Python will look for when it loads up the libraries.

For Mac Users

Open up a terminal window and do this:

$ cp ~/Downloads/graphics.py  /Library/Python/2.7/site-packages

Now that might give you a Permission denied error. If it doesn't, then you're all set. If it does, then try this instead:

$ sudo cp ~/Downloads/graphics.py /Library/Python/2.7/site-packages
Password:
(type in the password that you use to log onto your Mac)

For Windows Users:

Open up a window to C:\Python27\lib\site-packages and drag-and-drop the graphics.py file into there. You're all set

3. Copying stuff back and forth from the CS machines

If you want to copy stuff back and forth from the CS machines (to take programs home, or to copy your homework onto the CS machines so you can hand them in), you will need to download a program to help you to securely copy files over the network (ok, you don't need that program, technically, but it sure makes life a lot easier). I use the program Cyberduck. It's available for both Mac and Windows.

Once you have downloaded and installed it, use the following steps to create a secure link between your laptop and the CS machines:

  1. Click on Open Connection (obviously, launch the program first!)
  2. In the "server" text box, type in "lab.cs.swarthmore.edu"
  3. In the "Username" text box, type in the username that you use to log into the lab machines. No need for the .cs.swarthmore.edu suffix
  4. In the "Password" text box, type in the password that you use to log into the lab machines.
  5. In the pulldown menu at the top, select "SFTP (SSH File Transfer Protocol)" (third option down).
  6. Click "Connect"

It should open up a window for you. The default location for that window is your home directory. You can use it to see what files you have in your home directory. You can then navigate to your labs directory and drag-n-drop your files between your Mac Finder or Windows Explorer and the lab machines. Remember to run handin21 to hand things in!

Now you should be all set. Enjoy!