Installing Python

Installing Python

Python is available on various platforms (Windows, Mac, Linux).

Installing Python on Windows:

  • Download the latest version of Python 3 (Python 3.5.2 as of August 2016) from python.org/download

Python is developed under an open-source license, making it freely available.

Try to avoid alpha releases (typical named 3.xxx.ax), since they are still under development.

  • Choose the appropriated installer link for your computer.
  • Once download is finished, double-click it. Installation will start ….
  • Test the installation: Open Windows Start menu and choose All Programs. You should have an entry for Python 3. Select IDLE (Python GUI), which should launch the IDLE program. The first line tells you which Python version you are using.

Installing Python on Mac and Linux:

If you are using Mac OS X or Linux, you probably already have Python installed. To find out, open a command-line window or Terminal and type phyton. However, be careful, it might not be the correct or most recent version (see last chapter of document). To install a newer version in Mac OS X follow the first three points of the installation instruction for Windows. The details for installing Python under Linux will depend on the Linux Distribution. For example, on Ubuntu Linux, you would search for Python in the Synaptic Package Manager.

To run Python or IDLE (Python GUI) on Mac and Linux, type python or idle in command-line window or Terminal. CAREFUL, you might end up have both version of Python (2 and 3) installed. In this case the commands python and idle are often linked to Python 2, and the commands python3 and idle3 are linked to Python 3.

Python 2 versus Python 3:

If you are unsure which version of Python you are running, start run python and type

print “Hello World”

and enter.

If you see in fact Hello World you are running Python 2, if you get an error message, you are running Python 3. The only correct syntax for the print command in Python 3 is

print(“Hello World”)

This little example also shows, that Python 3 is not backwards compatible, which means Python 2 programs will not necessary work in Python 3. Therefore, it is important that you use Python 3 for your assignments.

Comments are closed.