Learning Resources
 

Windows and Linux installation


For GNU/Linux and BSD users

If you are using a distribution of GNU/Linux such as Ubuntu, Fedora, OpenSUSE, Debian, CentOS or {put your choice here}, or a BSD system such as FreeBSD, then it is most likely you already have Python installed on your system.

To test if you have Python already installed on your BSD or GNU/Linux box, open a shell program (like konsole or gnome-terminal) and enter the command python -V as shown below.

   $ python -V
   Python 3.2.2
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.

Note
If you have Python 2.x already installed, then try python3 -V.

In this case, you have two ways of installing Python on your system.

  • You can compile Python from the source code and install it. The compilation instructions are provided at the website.
  • Install the binary packages using the package management software that comes with your OS, such as apt-get in Ubuntu/Debian and other Debian-based distros, yum in Fedora, 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.

For Windows Users

Visit https://www.python.org/download/releases/ and download the latest version from this website, which was for 32bit and for 64bit when this text was last updated. This is just 17.6 MB which is very compact compared to most other languages or software. The installation is just like any other Windows-based software.

Caution - When you are given the option of unchecking any "optional" components, don't uncheck any! Some of these components can be useful for you, especially IDLE.

An interesting fact is that majority of Python downloads are by Windows users. Of course, this doesn't give the complete picture since almost all GNU/Linux users will have Python installed already on their systems by default.

DOS Prompt

If you want to be able to use Python from the Windows command line i.e. the DOS prompt, then you need to set the PATH variable appropriately.

For Windows 2000, XP, 2003 , click on Control Panel -> System -> Advanced -> Environment Variables. Click on the variable named PATH in the 'System Variables' section, then select Edit and add ;C:\Python32 to the end of what is already there. Of course, use the appropriate directory name.

For older versions of Windows, add the following line to the file C:\AUTOEXEC.BAT : 'PATH=%PATH%;C:\Python32' (without the quotes) and restart the system. For Windows NT, use the AUTOEXEC.NT file.

For Windows Vista

Click Start and choose Control Panel Click System, on the right you’ll see “View basic information about your computer” On the left is a list of tasks, the last of which is “Advanced system settings.” Click that. The Advanced tab of the System Properties dialog box is shown. Click the Environment Variables button on the bottom right. In the lower box titled “System Variables” scroll down to Path and click the Edit button. Change your path as need be. Restart your system. Vista didn’t pick up the system path environment variable change until I restarted.

For Windows 7

Right click on Computer from your desktop and select properties or Click Start and choose Control Panel > System and Security > System. Click on Advanced system settings on the left and then click on the Advanced tab. At the bottom click on Environment Variables and under System variables, look for the PATH variable, select and then press Edit.

Go to the end of the line under Variable value and append ;C:\Python32.

If the value was %SystemRoot%\system32; It will now become %SystemRoot%\system32;C:\Python32

Click ok and you are done. No restart is required.

-Swaroopch