linux 安装python的postgres库

PyGreSQL-4.0]# python setup.py build
sh: pg_config: command not found
Traceback (most recent call last):
File "setup.py", line 95, in <module>
    pg_include_dir = pg_config('/usr/local/pgsql/include')
File "setup.py", line 56, in pg_config
    raise Exception("pg_config tool is not available.")
Exception: pg_config tool is not available.

处理:

export

export PATH=$PATH:/usr/local/pgsql/bin/

pg_config

python stepup.py build

python setup.py install

问题:

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib64/python2.3/site-packages/pg.py", line 21, in ?
    from _pg import *
ImportError: libpq.so.5: cannot open shared object file: No such file or directory

解决:

cd /etc/ld.so.conf.d
echo "/usr/local/pgsql/lib" >>pgsql.conf
ldconfig

可能也可以:未试

# nano /etc/profile
在 unset i前面添加环境变量
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgsql/lib
# source /etc/profile

你可能感兴趣的:(linux,exception,python,File,Path,library)