- Download the archive, or by command
wget https://www.python.org/ftp/python/src/Python-0.9.1.tar.gz
. - Extract it to a directory.
- Change directory into “src”.
- Type
make
and execute it. If you do not install “make”, please install it. - Type
./python
to run the interactive shell.
You can add this directory to $PATH.
>>> # Print text
>>> print 'Hello world'
Hello world
>>> # “for” statement
>>> for i in range(10): print i
...
0
1
2
3
4
5
6
7
8
9
>>> # “while” statement
>>> a = 0
>>> while a < 5 :
... a = a + 1
... print a
...
1
2
3
4
5
>>> # “if” statement
>>> if 2 + 3 = 5: print '2 plus 3 is equal to 5'
...
2 plus 3 is equal to 5