This page walks through how to install a version of Python on Linux that is compatible with this tutorial.
Any version of Python 3 will work for this tutorial. If you don't have Python installed, we'll install Python version 3.4.1.
- Start up a Terminal. You can find the Terminal application at
Applications/Accessories/Terminal
, or it may already be on your menu bar.
This Terminal is another way of navigating your computer and running programs -- just textually instead of graphically. We are going to be running Python and Python scripts from this Terminal. - Test your Python installation at the Terminal prompt by typing
python
and pressing Enter. You should see something like
Python 3.4.1 (v3.4.1:d047928ae3f6, May 13 2013, 12:45:22) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>
You just started Python! The
>>>
indicates that you are at a new type of prompt -- a Python prompt. The Terminal prompt lets you navigate your computer and run programs, and the Python prompt lets you write and run Python code interactively. - Exit the Python prompt by typing
exit()
and pressing Enter. This will take you back to the Linux Terminal prompt.
If your Python version started with a 3, you are done with this section.
If your Python version started with a 2, you may have a version of Python 3 installed, just not as the default Python. Type
python3
at a Terminal prompt.
If this starts Python, you have a version of Python 3 installed, just not as the default Python. Please use the command python3 instead of python to start Python for the rest of this course.
If you have no version of Python 3 installed, we'll need to install it. Please continue to the instructions in the next section.
Please install Python 3.4 using your package manager, or from source using the source release at https://www.python.org/downloads/release/python-341/.
Please use the command python3 instead of python to start Python for the rest of this course.
You have tested your Python installation.
Questions? Please don't hesitate to reach out to the author (me, Jessica!) at:
jesstess@mit.edu
.