error: command 'gcc' failed with exit status when installing psycopg2

前端 未结 12 1879
情深已故
情深已故 2020-12-15 03:59

i need to install psycopg2 for openerp installation process, but i always found that error. i\'ve already used pip and easy_inst

相关标签:
12条回答
  • 2020-12-15 04:21

    On a fresh ubuntu 14.04.2 LTS on an EC2 instance, I was able to install psycopg2 after instaling the following packages:

    sudo apt-get install gcc
    sudo apt-get install postgres-xc-server-dev
    sudo apt-get install libpq-dev
    sudo apt-get install postgresql-client-common
    sudo apt-get install postgresql-common
    

    And on a fresh AMI linux (CentOS) instance:

    sudo yum install postgresql-devel
    sudo yum install gcc*
    

    Hope it helps,

    Erez

    0 讨论(0)
  • 2020-12-15 04:21

    psycopg2 is also available on PyPI in the form of wheel packages for the most common platform (Linux, OSX, Windows): this should make you able to install a binary version of the module, not requiring the above build or runtime prerequisites.

    You can use this command : pip install psycopg2-binary

    Note The psycopg2-binary package is meant for beginners to start playing with Python and PostgreSQL without the need to meet the build requirements. If you are the maintainer of a publish package depending on psycopg2 you shouldn’t use ‘psycopg2-binary’ as a module dependency. For production use you are advised to use the source distribution.

    0 讨论(0)
  • 2020-12-15 04:23

    May Your system is missing the Python headers. To fix this, run:

    sudo apt-get install python-dev
    

    or

    sudo apt-get install python3-dev
    
    0 讨论(0)
  • 2020-12-15 04:27

    i had this problem but was solved by running:

    pip install -Iv psycopg2==2.7.7
    

    There is a problem installing the latest version + python3.7

    0 讨论(0)
  • 2020-12-15 04:30

    For me, the missing package was

    libpqxx-devel.x86_64
    
    0 讨论(0)
  • 2020-12-15 04:31

    The invocation of gcc failed, gcc couldn't compile the source. Probably the cause is

    ./psycopg/psycopg.h:31:22: error: libpq-fe.h: No such file or directory In file included from psycopg/psycopgmodule.c:29:
    

    that the header libpq-fe.h is nowhere in the search path if you have it at all.

    0 讨论(0)
提交回复
热议问题