Getting started¶
Python Install¶
Anaconda¶
Is is strongly advised to install Python by using Anaconda:
Ready to go Python, with the main libraries installed (Numpy, Scipy, Matplotlib)
Possibility to create multiple environments with different versions of Python and packages (conda).
In practice:
Download the distribution corresponding to your system (cf. Download)
Install it in a place where you have read and write access.
Running Python¶
Running scripts¶
Open a text editor and type in:
import sys
# my first program (comment)
print('hello ', sys.argv)
Save as hello.py
Running using python¶
From the terminal type:
python hello.py arg1 arg2 arg3
You should see:
hello ['hello.py', 'arg1', 'arg2', 'arg3']
Running using ipython¶
Open ipython
from the terminal, then type:
run hello.py arg1 arg2 arg3
To check the environment, type whos
. You should see:
In [2]: whos
Variable Type Data/Info
------------------------------
sys module <module 'sys' (built-in)>
Running from Spyder¶
Open spyder
, open the file and click on the Run -> Configuration per file menu. Add arguments to the program as follows:
Then, click on the Run file button to run all the program or the Run selection button to run the current line
Run file button:
Run selection button: