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

前端 未结 12 1880
情深已故
情深已故 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:32

    In centos 7. i'd use sudo yum install postgresql96-devel.x86_64 to solved my problem.

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

    You'll need to install the development package for PostgreSQL, which for instance under Ubuntu is a sudo apt-get install libpq-dev... and for CentOS it's yum install postgresql-devel

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

    For the case of CentOS, I had this very same problem, that I solved installing these packages:

    sudo yum install postgresql-libs
    sudo yum install postgresql-devel
    sudo yum install python-devel
    

    only then, I was able to perform successfully:

    sudo easy_install psycopg2
    
    0 讨论(0)
  • 2020-12-15 04:40

    This worked for me on Ubuntu Server 14.10 64-bit:

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

    For Ubuntu 14.04, from Docker image python:3.4.3-slim this combination worked for me:

    sudo apt-get update
    sudo apt-get install -y build-essential
    sudo apt-get install -y python3.4-dev
    sudo apt-get install -y libpq-dev
    
    pip3 install psycopg2
    

    Note build-essential package. It was crucial in my case.

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

    I've been trying to install pgsql on a plain Amazon Linux EC2 instance, and have been getting this error. Per Nicolás answer, I installed his suggested list of packages, but I continued to get the error. Looking more closely at the error, I noticed that the gcc command was including pgsql93 files:

    gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.6.1 (dt dec pq3 ext lo64)" -DPG_VERSION_HEX=0x09030A -DHAVE_LO64=1 -I/usr/include/python2.7 -I. -I/usr/include/pgsql93 -I/usr/include/pgsql93/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-2.7/psycopg/psycopgmodule.o -Wdeclaration-after-statement

    Looking in /usr/include/ I see pgsql92/ but not pgsql93/. So I took a look at what pgsql-related yum packages were installed and I noticed these:

    postgresql92.x86_64 postgresql92-devel.x86_64 postgresql92-libs.x86_64 postgresql93.x86_64 postgresql93-libs.x86_64

    Seemed to me like there ought to be a postgresql93-devel, so I tried:

    sudo yum install postgresql93-devel

    And that fixed the problem for me! So I guess the theme is: Look at the gcc call, and see what dir it's pulling in. Follow the crumbs from there.

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