Python Programming - Installing Python

Python Programming – Installing Python

Python distribution is available for a wide variety of platforms. You need to download only the binary code applicable to your platform and install Python. You need a C compiler to compile the source code manually if the binary code for your platform is not available. The installation of Python at various platforms like Unix and Linux is given as follows

Unix and Linux Installation

Here are the simple steps to install Python on Unix/Linux machine.

  • Open a Web browser and go to http://www.pvthon.org/download/ as presented in Fig. 1.1.
  • Follow the link to download the zipped source code available for Unix/Linux.
  • Download and extract files.
  • Edit the Modules/Setup file if you want to customize some options.
  • run ./configure script ‘
  • make
  • make install.

This will install python in a standard location /usr/local/bin and its libraries dX/usr/local/lib/pythonXX where XX is the version of Python that you are using.

Python Programming - Installing Python chapter 1 img 1

Windows Installation

Here are the steps to install Python on a Windows machine.

  • Open a Web browser and go to http://www.pvthon.org/download/ as shown in Fig 1.1.
  • Follow the link for the Windows installer python-XYZ.msi file where XYZ is the version you need to install.
  • To use this installer python-XYZ.msi, the Windows system must support Microsoft Installer 2.0. Save the installer file to your local machine and then run it to find out if your machine supports MSI.
  • Run the downloaded file. This brings up the Python install wizard, which is really easy to use. Just accept the default settings, wait until the install is finished, and you are done.

Macintosh Installation

Recent Macs come with Python installed, but it may be several years out of date. See http://www.python.org/download/mac/ for instructions on getting
Since many shells are available in Unix/Linux OS, the path set up is slightly
different for different shells. For csh, bash, sh, and ksh shells the Python
path can be set as follows for a particular session in Unix:

  • In the csh shell: type setenv PATH “$PATH:/usr/local/bin/python” and press Enter.
  • In the bash shell (Linux): type export
    PATH=”$PATH:/usr/local/bin/python” and press Enter.
  • In the sh or Ksh shell: type PATH=”$PATH:/usr/local/bin/python” and press Enter.
    Note: /usr/local/bin/python is the path of the Python directory

Python Tutorial

Leave a Reply

Your email address will not be published. Required fields are marked *