https://pypi.org/project/py-mysql2pgsql/



https://packages.ubuntu.com/trusty/postgresql-server-dev-9.3


所以使用下面的命令即可安装python-dev:

yum install python-devel



I just had to install this on my CentOS 6 server since psycopg2 required pg_config. Boo yah:

yum install postgresql-devel

Update

If you still encounter issues with pg_config, you may need to add it to your PATH, e.g.:

export PATH=$PATH:/usr/pgsql-x.x/bin

where x.x is your version, such as /usr/pgsql-9.2./bin.


You can install it from rpmforge or epel repo:

# yum install libpqxx-devel


 
 

 

I just run this command as a root from terminal and problem is solved,

sudo apt-get install -y postgis postgresql-9.3-postgis-2.1
pip install psycopg2

or

sudo apt-get install libpq-dev python-dev
pip install psycopg2

================

sudo apt-get install postgresql

then fire:

sudo apt-get install python-psycopg2

and last:

sudo apt-get install libpq-dev


经过一番摸索,结合 psycopg2 官方文档,后来才发现需要把PostgreSQL的 libpq.so.5 跟系统的 libpq.so.5 进行替换,再重新安装psycopg2,问题即可解决:

 

1、find what is the libpq dynamic library used at runtime(查找运行过程中所用的libpq动态库):

$ ldd /path/to/packages/psycopg2/_psycopg.so | grep libpq   

2、You can avoid the problem by using the same version of the pg_config at install time and the libpq at runtime(替换运行过程中的libpq动态库):

root@localhost 17:26:46 /usr/local/download/psycopg2-2.6.1
=> cd /usr/lib64
root@localhost 17:24:09 /usr/lib64
=> rm libpq.so.5
root@localhost 17:24:09 /usr/lib64
=> ln -s /usr/local/postgresql-9.4.0/lib/libpq.so.5 ./

3、重新安装psycopg2,解决问题。

shenweiyan@localhost 20:24:34 /mydev/pyweb/download/psycopg2-2.5.4 
=> python
Python 2.7.5 (default, Jan 13 2015, 13:32:18) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
>>>


-- 
刘林强

136-1133-1997
liulinqiang@unipus.cn
北京外研在线教育科技有限公司
外语教学与研究出版社

转载于:https://www.cnblogs.com/SZLLQ2000/p/9453095.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值