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://pypi.org/project/py-mysql2pgsql/的更多相关文章

  1. windows环境pip安装时一直报错Could not fetch URL https://pypi.org/simple/xrld/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url:

    最近项目不忙了~~有开始专研的python大业,上来想用pip安装一个第三方的库,就一直报错: Could not fetch URL https://pypi.org/simple/xrld/: T ...

  2. 解决 ‘Could not fetch URL https://pypi.python.org’的问题

    [前提]: win10下python3和python2共存环境,但是环境变量只配置了python3 [问题]: 用pip安装一个包执行pip2 install xxx的时候报错Fatal error ...

  3. 使用python+xpath 获取https://pypi.python.org/pypi/lxml/2.3/的下载链接

    使用python+xpath 获取https://pypi.python.org/pypi/lxml/2.3/的下载链接: 使用requests获取html后,分析html中的标签发现所需要的链接在& ...

  4. HanLP https://pypi.python.org/pypi/sumy/

    HanLP - 汉语言处理包 http://hanlp.linrunsoft.com/doc.html https://pypi.python.org/pypi/sumy/

  5. pip install xxx -i https://pypi.tuna.tsinghua.edu.cn/simple

    pip install xxx -i https://pypi.tuna.tsinghua.edu.cn/simple 快速下载

  6. pip install xxx Could not fetch URL https://pypi.org/simple/pip/

    Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirmingthe ssl certificate: ...

  7. Cannot fetch index base URL https://pypi.python.org/simple/

    这个就是相源的问题,正常安装你的根目录下会有这个pip.log文件,如下 root@liu:~# ll .pip/ total 16 drwxr-xr-x 2 root root 4096 Sep 1 ...

  8. 日常问题--解决 ‘Could not fetch URL https://pypi.python.org’的问题

    难题描述: 解决方法: 使用命令python -m pip install Scrapy  --trusted-host=pypi.python.org --trusted-host=pypi.org ...

  9. 虚拟环境中pip install requirments.txt: Cannot fetch index base URL https://pypi.python.org/simple/

    Stackoverflow  : http://stackoverflow.com/questions/15501133/python-pip-error-cannot-fetch-index-bas ...

随机推荐

  1. 译: 1. RabbitMQ Spring AMQP 之 Hello World

    本文是译文,原文请访问:http://www.rabbitmq.com/tutorials/tutorial-one-spring-amqp.html RabbitMQ 是一个Brocker (消息队 ...

  2. vue.js开发SPA常见问题及解决方法

    列表进入详情页的传参问题. 例如商品列表页面前往商品详情页面,需要传一个商品id; <router-link :to="{path: 'detail', query: {id: 1}} ...

  3. oracle 回收表空间的数据文件大小

    查看表空间的使用情况: " "used MB",b.bytes "free MB", ,) "percent_used" from ...

  4. CentOs 6.x 升级 Python 版本【转】

    在CentOS 6.X 上面安装 Python 2.7.X CentOS 6.X 自带的python版本是 2.6 , 由于工作需要,很多时候需要2.7版本.所以需要进行版本升级.由于一些系统工具和服 ...

  5. winserver2012 自启动软件

    开始->运行->输入shell:startup 在打开的启动文件夹中,将需要启动程序的快捷方式复制进去,完工 重启试试吧

  6. java 汉诺塔实现自动演示

    1.增加计时功能,显示用户完成移动盘子所花费的时间 2.用户可以设置最大和最小盘子的大小 3.用户可以选择播放和暂停背景音乐 4.用户可以设置盘子的数目 5.用户可以设置盘子的颜色以及背景的颜色 6. ...

  7. C语言中的字符串处理库函数介绍与实现

    一.介绍 本文将主要介绍字符串处理库函数中的strlen.strcpy.strcat.strcmp.atoi等,主要由<string.h>头文件提供. 二.strlen函数:求字符串的长度 ...

  8. [Artoolkit] Marker Training

    Link: Documentation About the Traditional Template Square Marker Limitations (重要) Traditional Templa ...

  9. [Laravel] 12 - WEB API : cache implement

    前言 Ref: https://www.imooc.com/video/2873 服务端如何为客户端(app)的首页提供数据接口, 本篇用此作为例子演示接口的实现. 单例模式 一.三大原则 单例实现 ...

  10. OpenGL——三维多面体实现

    #include<iostream> #include <math.h> #include<Windows.h> #include <GL/glut.h> ...