Python by Swaroop C H - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

Chapter 2. Installing Python
For Linux/BSD users

If you are using a Linux distribution such as Fedora or Mandrake or {put your choice here}, or a BSD system such as FreeBSD, then you probably already have Python installed on your system. To test if you have Python already installed on your Linux box, open a shell program (like konsole or gnome-terminal) and enter the command python -V as shown below.

 

$ python -V Python 2.3.4

Note

$ is the prompt of the shell. It will be different for you depending on the settings of your OS, hence I will indicate the prompt by just the$ symbol.

 

If you see some version information like the one shown above, then you have Python installed already. However, if you get a message like this one:

 

$ python -V
bash: python: command not found

 

then, you don't have Python installed. This is highly unlikely but possible. In this case, you have two ways of installing Python on your system.

• Install the binary packages using the package management software that comes with your OS, such as yum in Fedora Linux, urpmi in Mandrake Linux, apt-get in Debian Linux, pkg_add in FreeBSD, etc. Note that you will need an internet connection to use this method.

Alternatively, you can download the binaries from somewhere else and then copy to your PC and install it.

 

You can compile Python from the source code [http://www.python.org/download/] and install it. The compilation instructions are provided at the website.