After you have done a basic Python installation, you should start up the Python interpreter and start working through a Python language tutorial. On Mac or Linux you can do this by opening a terminal window (either plain or x11 on Mac) and simply typing the command python at the prompt. For more convenience, if you have idle installed, you can type the command idle instead, and you'll get a nicer interpreter window that auto-indents, allows you to edit several lines at a time, and colorizes according to Python grammar. You can also open an editor window, which allows you to write, edit, save and run your scripts. If you are logging in to a server to run Python, you need to be logged in from an xterm (using ssh -Y or maybe ssh -X) in order to use idle or any other thing that puts up graphics. On a Mac or on Windows, you can start up idle by double-clicking the idle icon, but Python may have some trouble finding the courseware modules when you start using them, depending on exactly where these modules were put; also, Python may not be able to display graphics that rely on the x11 windowing system. More information on writing and running scripts can be found in the tutorials linked below.
Resources for learning Python
- My own quick-start introduction to Python for physical scientists (updated 9/30/2010) is here. I will be making further updates to this soon, so stay tuned and check back from time to time.
- A comprehensive online reference to setting up and using Python, as well as documentation of the Python language (including many useful tutorials) can be found here. The Tutorial is especially recommended for beginners.
- The entire Dive into Python book is available online here. It has a good discussion of how to install and run Python on your own computer. It is also a good general reference on the Python language.
- Online is great, but sometimes paper is even better. If you'd like to buy a physical book to help you with Python, I can recommend the following:
- Magnus Lee Hetland Practical Python. Apress
- Hans Petter Langtangen Python Scripting for Computational Science. Springer. (Recommended especially for Python programmers seeking a master of more advanced topics. This book has good coverage of techniques for using compiled c, c++ or Fortran routines for extending Python. )
- You can also buy a physical copy of Dive into Python
[**These just illustrate basic Python syntax and use of numpy. For example scripts illustrating use of the courseware, see the Courseware page. ]