zoukankan      html  css  js  c++  java
  • 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
    北京外研在线教育科技有限公司
    外语教学与研究出版社
  • 相关阅读:
    第12组 Alpha冲刺(4/6)
    第12组 Alpha冲刺(3/6)
    第12组 Alpha冲刺(2/6)
    第12组 Alpha冲刺 (1/6)
    第12组(78) 需求分析报告
    第12组(78)团队展示
    结对编程作业
    第06组Beta冲刺(2/5)-(组长)
    第06组Beta冲刺(1/5)-(组长)
    第06组Alpha冲刺(6/6)-(组长)
  • 原文地址:https://www.cnblogs.com/SZLLQ2000/p/9453095.html
Copyright © 2011-2022 走看看