我没有超级用户权限,所以我将psycopg2模块安装到/ opt(我有权访问该目录):
$python setup.py install --prefix=/opt
我尝试了几种方法:
#.bashrc
PATH=$PATH:$HOME/bin:/opt/lib/python2.4/site-packages/psycopg2/
export PATH
或
#.bash_profile
PATH=$PATH:$HOME/bin:/opt/lib/python2.4/site-packages/
export PATH
我也试过sys.path.append('/opt/lib/python2.4/site-packages/psycopg2/')
无效:
$python
>>>import psycopg2
>>>no psycopg2 module
/opt/lib/python2.4/site-packages/psycopg2/
或/opt/lib/python2.4/site-packages/
路径无效
请帮助,谢谢