步骤如下:
1.下载源码包psycopg2-2.7.5.tar.gz
2.找到postgres的安装路径,假设为 /paic/postgres/base/10.3/bin
3.执行:export PATH="$PATH:/paic/postgres/base/10.3/bin"
4.解压psycopg2:tar -zxvf psycopg2-2.7.5.tar.gz
5.cd psycopg2-2.7.5
6.安装:
(1) python3 setup.py build
(2) python3 setup.py install
7.把libpg.so.5所在路径加入LD_LIBRARY_PATH
(1) export LD_LIBRARY_PATH=/paic/postgres/base/10.3/lib:$LD_LIBRARY_PATH
(2) sudo ldconfig