1. Python versions
Currently there are two major versions of Python being maintained (details are beyond the scope of this document):
- Version 2.7 is the older and is said that the community will maintain it indefinitely or until they run out of cookies. 🙂
- Version 3.4 is the current version that is pushing forward ever so steadily.
2. Downloading and installing python
Since Python can be run on all major operating systems, there are many different ways to download and install it. Lets explore some general ways this can be accomplished.
Ubuntu (linux) comes preloaded with python; however if a new one is needed you could use the following methods (there are many other ways):
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.7
Download and install the source from either the:
- First lets update:
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
- Now download:
from either here.
or with wget http://python.org/ftp/python/2.7.x/Python-2.7.x.tgz
- Now Uncompress: tar -xvf Python-2.7.x.tgz
- Finally install:
Now in order to use this version of Python we have just installed we will probably need to add its location to our PATH. In MacOS X or Linux operating systems you will need to edit the ~/.profile or ~/.bashrc file and added the following line:
Obviously “/path/to/Python/programs” is the location where you just installed python into.
!IMPORTANT! on *nix system after you have saved your changes and exit the editor you will need to type one of these commands:
- $ source ~/.bashrc
- $ . ~/.bashrc
- $ exec bash(not sure if this works on Mac)
which update your environment with the new changes.
Next post will be about how we actually use python regarding interpreters and shells. Coming soon…