How to Create Your Own Python Environment Locally in Your Shared Hosting Account
Written by Tabaré Patiño Tuesday, 25 December 2012
Here is what you need to do in order to accomplish that:
1- login to ssh
2- execute de following commands:
mkdir ~/dev
cd ~/dev
wget http://www.python.org/ftp/python/2.6.4/Python-2.6.4.tgz (you can download any version)
tar -xzvf Python-2.6.4.tgz
cd Python-2.6.4
./configure –prefix=$HOME/dev
make && make install
3- Install virtual python
curl http://peak.telecommunity.com/dist/virtual-python.py | $HOME/dev/bin/python2.6
4- Install easy_install
curl http://peak.telecommunity.com/dist/ez_setup.py | $HOME/bin/python2.6
Once you have completed this, you will notice that a new directory has been created. Virtual Python and Easy_Install binaries will be under $HOME/bin.
Therefore in your python scripts you will change the interpreter to !#/home/user/bin/python
If you need additional modules, you will do the following:
/home/user/bin/easy_install2.6 flup
/home/user/bin/easy_install2.6 django
If you need a specific version, you can do this: /home/user/bin/easy_install2.6 django lxml==2.2.8 for example. It should work also like /home/user/bin/easy_install2.6 django==2.2.8. But take into consideration those 2 options.
That’s the reason why you will use the binary of virtual python rather than the one compiled first. It allows you to create your own environments locally in your account.
Finally, add the following line to your ~/.bash_profile file:
$PATH=$HOME/bin:$PATH
Compile the changes:
source ~/.bash_profile
You can also create aliases in your .bashrc file:
alias python=’/home/user/bin/python’
alias easy_install=’/home/user/bin/easy_install2.6′
Compile the changes:
source ~/.bashrc
In that way, every time you call those binaries from ssh, they will reference your local installation instead of the server wide version 
Hope it helps!
Looking for quality Python Web Hosting? Look no further than Arvixe Web Hosting!
