/ bluehost

Install Python 2.7 on BlueHost

After I discovered the presence of Python 2.6 on BlueHost, they decided to remove this installation by default. Fortunately it's really simple to build Python from sources and install it (and naturally, the good thing is that all required packages to build Python are installed on BlueHost servers).

So here the steps to follow to build and install the python version you prefer (tested with Python 2.6 and 2.7.x).

 wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar xzvf Python-2.7.2.tgz

and, just a note, the package is well done and it will create a Python subfolder :)

After this we can already configure and install it.

 cd Python-2.7.2
./configure -prefix=/home2/mornatin/python272 --enable-unicode=ucs4
make
make install

Change the Python version in this example and the installation directory with what you prefer. Naturally, considering you are on shared host (if you have a dedicated server you can install python using your distribution package system), you have access only to your home folder, so the target directory must be inside your home.

If all worked well, at the end of this procedure your python is correctly install in your system and you can start using it. To test you can just simply try to start the binary file

 /home2/mornatin/python272/bin/python

A thing I can suggest, if you don't want to override the BlueHost default python and/or if you want to install different python version, is to rename the python binary with something different. For example:

 mv /home2/mornatin/python272/bin/python /home2/mornatin/python272/bin/python27

After this step you can add the python bin folder to your PATH and use it everywhere:

 export PATH=/home2/mornatin/python272/bin:$PATH

All configured and you can start working with your new python version. An important thing to remember is that, if you haven't python 2.7 (or other) configured as default python, when you want to install a new module in it, you should invoke the correctly binary file. Following this installation example:

 python27 setup.py install