error: command 'gcc' failed with exit stat

2019-02-05 21:43发布

i need to install psycopg2 for openerp installation process, but i always found that error. i've already used pip and easy_install, my gcc is the latest version. Really need your help to solve my problem...

this is my complete error with easy_install..

[root@server01 ~]# easy_install psycopg2    
Searching for psycopg2    
Reading http://pypi.python.org/simple/psycopg2/    
Reading http://initd.org/psycopg/    
Reading http://initd.org/projects/psycopg2    
Best match: psycopg2 2.4.5    
Downloading http://initd.org/psycopg/tarballs/PSYCOPG-2-4/psycopg2-2.4.5.tar.gz    
Processing psycopg2-2.4.5.tar.gz    
Running psycopg2-2.4.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-anWVvJ/psycopg2-2.4.5/egg-dist-tmp-cZbdtn

no previously-included directories found matching 'doc/src/_build' In file included from psycopg/psycopgmodule.c:27:
./psycopg/psycopg.h:31:22: error: libpq-fe.h: No such file or directory In file included from psycopg/psycopgmodule.c:29:

...

error: Setup script exited with error: command 'gcc' failed with exit status 1

10条回答
孤傲高冷的网名
2楼-- · 2019-02-05 22:14

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

sudo apt-get install libpqxx-dev
查看更多
小情绪 Triste *
3楼-- · 2019-02-05 22:15

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
查看更多
Animai°情兽
4楼-- · 2019-02-05 22:17

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
查看更多
贼婆χ
5楼-- · 2019-02-05 22:24

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

查看更多
登录 后发表回答