30.1.9 Installing Python from Source

It is very likely that if you have a Unix system (other than Linux), Python will not be installed. However, downloading, building and installing Python is very simple and works on every platform on which OEChem is available. Go to http://www.python.org/download and get the latest version of Python 2.3 (Python 2.3.4, as of this writing). Following that link will bring you to a v2.3.4 specific download page so you can download Python-2.3.4.tgz (or similar for a different version number). Save this file in an empty directory and then follow the simplified directions below (or better yet, follow the INSTALL directions found in the .tgz file)

  1. cd to the directory containing the Python-2.3.4.tgz file.
  2. gunzip Python-2.3.4.tgz
  3. tar -xvf Python-2.3.4.tar
  4. cd Python-2.3.4
  5. ./configure The main option to configure is a decision about the root of the install tree and whether or not to use gcc as the compiler.

    By default, configure will choose /usr/local such that the application ends up in /usr/local/bin/python and the associated library files end up in /usr/local/lib/python2.3. Additionally, if gcc is in your path, the default configure will use gcc to build Python. It is important that the C compiler used to build Python match the version of the C compiler used to build Python-OEChem, so see the specific section below for your platform.

    If you are happy with the default then just run:

    ./configure
    

    If you have an alternate place (such as /apps or /sw) the run configure as:

    ./configure --prefix=/apps
    

    To use the native, system compiler instead of gcc:

    ./configure --without-gcc
    

    On Linux, to use the system gcc in /usr/bin instead of a newer version installed in /usr/local/bin:

    export CC=/usr/bin/gcc
    ./configure
    

  6. run ``make''
  7. As root, run ``make install''
  8. As a normal user, start a new shell and type:

    which python
    

    and make sure it points to /usr/local/bin/python if you ran configure without a prefix option or to /apps/bin/python, /sw/bin/python, etc. depending on the actual prefix you fed configure in step 5.