How to install python package(s) in web hosting

1. make modules directory under your account home (e.g) your_home/modules)

$cd ~
$mkdir modules

2. run below command (in below example, i install geopy)
$PYTHONPATH=~/modules easy_install-2.6 –install-dir ~/modules geopy

3. mode to module directory
$cd ~/modules/geopy

4. run below command
$PYTHON=~/moduels python install –install-lib ~/modules

5. In your python script, you need to add shebang like below
#!/usr/bin/eval PYTHONPATH=/home/your_home/moduels python

6. Lastly, create your .bash_profile to notify correct python path to your shell
$vi .bash_profile

7. add below line in your .bash_profile file
export PYTHONPATH=~/modules/
export PATH=~/modules/:$PATH

About sydlife

Lazy programmer, Dad and Husband.
%d bloggers like this: