Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add module to pythonpath - nothing works

I don't have root access so I installed psycopg2 module to /opt (I have permission for that directory):

$python setup.py install --prefix=/opt

I've tried several methods:

#.bashrc        
PATH=$PATH:$HOME/bin:/opt/lib/python2.4/site-packages/psycopg2/
export PATH  

or

#.bash_profile  
PATH=$PATH:$HOME/bin:/opt/lib/python2.4/site-packages/
export PATH

I also tried sys.path.append('/opt/lib/python2.4/site-packages/psycopg2/')

nothing works:

$python  
>>>import psycopg2
>>>no psycopg2 module

Neither /opt/lib/python2.4/site-packages/psycopg2/ or /opt/lib/python2.4/site-packages/ path works

Please help, thank you

like image 806
BPm Avatar asked Oct 11 '11 20:10

BPm


1 Answers

Try $PYTHONPATH instead of $PATH in your bash configuration file. For more info look at the official documentation on this topic.

like image 164
lc2817 Avatar answered Oct 04 '22 11:10

lc2817