Add module in pythonpath - nothing works

I do not have root access, so I installed the psycopg2 module in / opt (I have permission for this directory):

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

I 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 traffic /opt/lib/python2.4/site-packages/psycopg2/ nor /opt/lib/python2.4/site-packages/ work

Please help, thanks.

+7
source share
1 answer

Try $PYTHONPATH instead of $PATH in the bash configuration file. For more information, see the official documentation on this topic .

+13
source

All Articles