error: command 'gcc' failed with exit status 1 on CentOS

Simple-Solution picture Simple-Solution · Nov 13, 2013 · Viewed 107.1k times · Source

I'm trying to install lxml package on CentOS using sudo pip install lxml and its throwing this error right at the end:

error:

error: command 'gcc' failed with exit status 1

---------------------------------------

Command /usr/bin/python -c "import setuptools;__file__='/tmp/pip-build-root/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-PjviBq-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-root/lxml
Storing complete log in /root/.pip/pip.log

[hg@user-centos-1 ~]$ error: command 'gcc' failed with exit status 1
bash: error:: command not found

Answer

Coko Tracy Musaza picture Coko Tracy Musaza · Apr 30, 2016

" error: command 'gcc' failed with exit status 1 ". the installation failed because of missing python-devel and some dependencies.

the best way to correct gcc problem:

You need to reinstall gcc , gcc-c++ and dependencies.

For python 2.7

$ sudo yum -y install gcc gcc-c++ kernel-devel
$ sudo yum -y install python-devel libxslt-devel libffi-devel openssl-devel
$ pip install "your python packet"

For python 3.4

$ sudo apt-get install python3-dev
$ pip install "your python packet"

Hope this will help.