There are many ways in which you can install and use Python. But if you're unsure how to get started, the instructions below are a good way to get coding quickly!
Python 2 or 3?
There are two main versions of Python: 2 and 3. The recommended version is Python 3, which is newer and actively maintained. Python 2 is still widely used, but only because some Python libraries have not yet been updated to be compatible with Python 3.
Rapunzel is a free code editor focused on numerical computing with Python. It is included with OpenSesame. You can also download it as a standalone application from here:
In Rapunzel, create an empty document (
Ctrl+N) and enter the code
print('Hello world!') in the editor window. Next, press
F9 to execute (Figure 1). This will execute this line of code in the so-called IPython Console, which by default is on the bottom of the window. You can also type directly into this console.
Anaconda is a Python distribution that comes with many useful packages pre-installed. Notably, it comes with Spyder pre-installed, which is another popular code editor for Python.
- Visit http://anaconda.org/, click on Download Anaconda, and download the 64 bit version for Python 3.
- Once the
.exeinstaller has been downloaded, launch it and follow the steps to install Anaconda on your system. The default installation settings are generally fine.
- Now launch Spyder, which has been installed as part of Anaconda.
In Spyder, enter the code
print('Hello world!') in the editor window, select it and press
F9 to execute (Figure 2). This will execute this line of code in the so-called IPython Console, which by default is on the bottom-right of the window. You can also type directly into this console.
All set up? Then let's begin with exploring the basic Python syntax!