Introduction to Programming and Scientific Applications (Spring 2018)

General information about Python

To develop Python programs you need to be able to edit Python programs and to be able to execute Python programs.

Editing can in principle be done using any basic text editor like Notepad on Windows, but in practice one would like a more advanced editor that automatically formats and hilights your program, and gives more advanced editing. Examples are IDLE and Spyder, which automatically will be installed depending on if you install CPython from python.org or Anaconda as described below.

To execute a Python program you need an interpreter. The reference implementation and most widely used implementation is CPython which can be installed from python.org/downloads or www.anaconda.com/download/ as described below. But other implementations exist, e.g. PyPy as mentioned below. An overview can be found on www.python.org/download/alternatives/.

Windows 10 installation

CPython, pip, and IDLE

From python.org you can download the reference implementation of Python, nicknamed CPython (since it is coded in C):

Note. By default a 32 bit Windows version of Python is installed. If you need to run very memory consuming Python programs on Windows (requiring above 2GB of RAM), you should make sure to download the 64 bit version of Python, available at www.python.org/downloads/windows/ as "Windows x86-64 executable installer".

Additional Python packages are installed using the program "pip3", included in the above download. To e.g. install the SciPy package that will be used in the course (see SciPy.org for more information on the package):

Part of the download is IDLE, an integrated development environment for Python. Existing Python files (ending on .py) can be opened and edited in IDLE by right-clicking on the file and selecting "Edit with IDLE". The IDLE application should also appear in your Windows Start menu (or Windows-key + "IDLE").

A Python program program can be executed in several ways. (1) The easiest is just to double click on the file name, but this closes the output window immediately after the program terminates. (2) Open the program in IDLE and press F5 to "Run Module". (3) Execute the program from a Windows shell:

Anaconda - an easy start to Python

Anaconda writes on their webpage that it is "The Most Popular Python Data Science Platform". Anaconda bundles Python (a very recent version, but not necessarily the most recent), a lot of libraries, and the Spyder IDE. To install Anaconda:

PyPy - for the performance demanding Python programmer

PyPy is alternative implementation of the Python language that is often faster than CPython, but does not support the most recent versions of Python. To install PyPy:

The speed improvements of PyPy over CPython are due to the usage of the Just-In-Time compilation technique, that e.g. also is used inside the Google Chrome browser for executing JavaScript (see the Wikipedia page on Chrome V8) and by Java Virtual Machines for executing Java programs (bytecode) (see more on Just-In-Time compilation on Wikipedia).

Mac OS X and Linux installation

If you are using Mac OS X or Linux then the above webpages also contain download links for CPython/IDLE/pip, Anaconda and PyPy.