We require you to have a laptop (with Linux, or Mac) for the practical exercises. If you do not have one, or want to borrow one from us, please contact us at firstname.lastname@example.org before the beginning of the course.
Before the first lecture, we have the 3 following requirements:
- Install Python on your machine (obviously),
- Check that the installation went fine, by running a given simple script,
- Make sure you have a proper text editor
How to install Python
On the Python website, the latest
version available is
3.6.0. Please, choose to install the version
3.5.0 or above. You can install the latest Python
Mac OS X
You can borrow a Linux laptop where we have installed Python 3.5+ for you. If you insist on using your own Windows machine, here are the installation steps on Windows. The installer should look like:
On Mac OS X
Since Mac OS X 10.8, Python 2.7 is pre-installed by Apple. This is an incompatible version with this course. You should instead download the installer for the version 3.5.0 (or choose a newer one), double-click and follow the instructions.
More information can be found on docs.python.org/3.5
IMPORTANT NOTE: If you are not interested in a system-wide version of Python3, you can use
pyenvto easily switch between multiple versions of Python. You can install pyenv from GitHub. After installation, you can install version 3.5.0 by issuing the following command in your Terminal.
$ pyenv install 3.5.0
You probably know what to do if we give you the Python 3.5.0 sources. You are surely familiar with the classic cycle:
./configure make make test sudo make install
Testing your installation
Start your favorite terminal and check the Python version. Type at the
prompt (ie where the
$ sign is):
$ python --version
or start the python interpretor
Running a test script
Download this test script (from the NBIS GitHub location for this instance of the course), and in your terminal, run
$ python test.py
…in the folder where the script resides. If this works fine, you should see the current time printed with “big digits” ;)
Alternatively, copy-paste that line at the prompt
curl -s https://raw.githubusercontent.com/NBISweden/PythonCourse/vt17/test.py | python
Using a proper Text Editor
We are going to type (a lot of) Python code, so you’d better have a good text editor. This is useful for several reasons: The text editor can highlight the Python keywords and handles the particulars regarding tabulations (which we will introduce in the course).
Emacs and Vim are probably the best text editors, albeit for tech-savvy people. If you are not the latter kind, Sublime Text or Atom are excellent cross-platform alternative. You should probably customize it to your taste first.
In the course, we will write Python code as standalone files. However, during the lecture, we will also use Jupyter notebooks. Jupyter is a web-based tool which allows us to evaluate our code line by line. The Jupyter files are called notebooks and will serve a single purpose in this course: a quick demonstration of Python code. It is therefore convenient, though optional, to install Jupyter in advance.
Impatient about the first lecture?
Whet your appetite on the Python tutorial or an informal introduction to Python.