linux下安装python3.7.3模块psycopg2

无法连接外网,不能使用yum,pip等
安装的postgresql版本是12.2
下载psycopg2-2.8.6.tar.gz和postgresql12-devel-12.2-2PGDG.rhel6.x86_64.rpm(https://download.postgresql.org/pub/repos/yum/12/redhat/rhel-6-x86_64/postgresql12-devel-12.2-2PGDG.rhel6.x86_64.rpm)
安装依赖库:

[[email protected] python3]# rpm -ivh postgresql12-devel-12.2-2PGDG.rhel6.x86_64.rpm --nodeps --force

解压psycopg2-2.8.6.tar.gz及安装
[[email protected] python3]# tar -xvf psycopg2-2.8.6.tar.gz
[[email protected] python3]#cd psycopg2-2.8.6

linux下安装python3.7.3模块psycopg2发现pg_config not found
将安装psql客户端的pg_config目录找到
[[email protected] psycopg2-2.8.6]#sudo su
[[email protected] psycopg2-2.8.6]#export PATH=/usr/pgsql-12/bin:$PATH
linux下安装python3.7.3模块psycopg2安装成功并测试无异常
linux下安装python3.7.3模块psycopg2