问题:安装脚本退出,并显示错误:命令’x86_64-linux-gnu-gcc’失败,退出状态为1
尝试安装时odoo-server
,出现以下错误:
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
谁能帮我解决这个问题?
When I try to install odoo-server
, I got the following error:
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Could anyone help me to solve this issue?
回答 0
我在大学的最后一年的主要项目中安装了Linux Mint时遇到了同样的问题,下面的第三个解决方案对我来说很有效。
遇到此错误时,请在错误之前注明,它可能表示您缺少软件包或头文件-您应找到并安装它们并验证其是否有效(例如ssl→libssl)。
对于Python 2.x,请使用:
$ sudo apt-get install python-dev
对于Python 2.7,请使用:
$ sudo apt-get install libffi-dev
对于Python 3.x,请使用:
$ sudo apt-get install python3-dev
或对于特定版本的Python 3,请x
用中的次要版本替换
$ sudo apt-get install python3.x-dev
I encountered the same problem in college having installed Linux Mint for the main project of my final year, the third solution below worked for me.
When encountering this error please note before the error it may say you are missing a package or header file — you should find those and install them and verify if it works (e.g. ssl → libssl).
For Python 2.x use:
$ sudo apt-get install python-dev
For Python 2.7 use:
$ sudo apt-get install libffi-dev
For Python 3.x use:
$ sudo apt-get install python3-dev
or for a specific version of Python 3, replace x
with the minor version in
$ sudo apt-get install python3.x-dev
回答 1
Python.h is nothing but a header file. It is used by gcc to build applications. You need to install a package called python-dev. This package includes header files, a static library and development tools for building Python modules, extending the Python interpreter or embedding Python in applications.
enter:
$ sudo apt-get install python-dev
or
# apt-get install python-dev
see http://www.cyberciti.biz/faq/debian-ubuntu-linux-python-h-file-not-found-error-solution/
回答 2
尝试安装这些软件包。
sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev libssl-dev
sudo easy_install greenlet
sudo easy_install gevent
Try installing these packages.
sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev libssl-dev
sudo easy_install greenlet
sudo easy_install gevent
回答 3
您需要安装以下软件包:
sudo apt-get install libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev
You need to install these packages:
sudo apt-get install libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev
回答 4
$ sudo apt-get install gcc
$ sudo apt-get install python-dateutil python-docutils python-feedparser python-gdata python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi
或尝试一下:
$ sudo apt-get install libxml2-dev libxslt1-dev
$ sudo apt-get install gcc
$ sudo apt-get install python-dateutil python-docutils python-feedparser python-gdata python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi
OR TRY THIS:
$ sudo apt-get install libxml2-dev libxslt1-dev
回答 5
对于Python 3.4,请使用:
sudo apt-get install python3.4-dev
对于Python 3.5,请使用:
sudo apt-get install python3.5-dev
对于Python 3.6,请使用:
sudo apt-get install python3.6-dev
对于Python 3.7,请使用:
sudo apt-get install python3.7-dev
对于Python 3.8,请使用:
sudo apt-get install python3.8-dev
… 等等 …
For Python 3.4 use:
sudo apt-get install python3.4-dev
For Python 3.5 use:
sudo apt-get install python3.5-dev
For Python 3.6 use:
sudo apt-get install python3.6-dev
For Python 3.7 use:
sudo apt-get install python3.7-dev
For Python 3.8 use:
sudo apt-get install python3.8-dev
… and so on …
回答 6
对我而言,以上方法均无效。但是,我解决了安装问题libssl-dev
。
sudo apt-get install libssl-dev
如果您遇到与我的情况相同的错误消息,这可能会起作用:
致命错误:openssl / opensslv.h:没有此类文件或目录…..命令’x86_64-linux-gnu-gcc’失败,退出状态为1
For me none of above worked. However, I solved problem with installing libssl-dev
.
sudo apt-get install libssl-dev
This might work if you have same error message as in my case:
fatal error: openssl/opensslv.h: No such file or directory … ….
command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
回答 7
就我而言,它缺少软件包libffi-dev。
什么有效:
sudo apt-get install libffi-dev
In my case, it was missing package libffi-dev.
What worked:
sudo apt-get install libffi-dev
回答 8
在Ubuntu 14.04上:
sudo apt-file search ffi.h
回:
chipmunk-dev: /usr/include/chipmunk/chipmunk_ffi.h
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ffi.html
jython-doc: /usr/share/doc/jython-doc/html/javadoc/org/python/modules/jffi/jffi.html
libffi-dev: /usr/include/x86_64-linux-gnu/ffi.h
libffi-dev: /usr/share/doc/libffi6/html/Using-libffi.html
libgirepository1.0-dev: /usr/include/gobject-introspection-1.0/girffi.h
libgirepository1.0-doc: /usr/share/gtk-doc/html/gi/gi-girffi.html
mlton-basis: /usr/lib/mlton/include/basis-ffi.h
pypy-doc: /usr/share/doc/pypy-doc/html/config/objspace.usemodules._ffi.html
pypy-doc: /usr/share/doc/pypy-doc/html/config/objspace.usemodules._rawffi.html
pypy-doc: /usr/share/doc/pypy-doc/html/rffi.html
我选择安装libffi-dev
sudo apt-get install libffi-dev
工作完美
on ubuntu 14.04:
sudo apt-file search ffi.h
returned:
chipmunk-dev: /usr/include/chipmunk/chipmunk_ffi.h
ghc-doc: /usr/share/doc/ghc-doc/html/users_guide/ffi.html
jython-doc: /usr/share/doc/jython-doc/html/javadoc/org/python/modules/jffi/jffi.html
libffi-dev: /usr/include/x86_64-linux-gnu/ffi.h
libffi-dev: /usr/share/doc/libffi6/html/Using-libffi.html
libgirepository1.0-dev: /usr/include/gobject-introspection-1.0/girffi.h
libgirepository1.0-doc: /usr/share/gtk-doc/html/gi/gi-girffi.html
mlton-basis: /usr/lib/mlton/include/basis-ffi.h
pypy-doc: /usr/share/doc/pypy-doc/html/config/objspace.usemodules._ffi.html
pypy-doc: /usr/share/doc/pypy-doc/html/config/objspace.usemodules._rawffi.html
pypy-doc: /usr/share/doc/pypy-doc/html/rffi.html
I chose to install libffi-dev
sudo apt-get install libffi-dev
worked perfectly
回答 9
在我pip
无法安装库的情况下,我尝试了上面给出的解决方案,但没有一个起作用,但下面的对我有效:
sudo apt upgrade gcc
In my case pip
was unable to install libraries, I tried solutions given above, but none worked but the below worked for me:
sudo apt upgrade gcc
回答 10
尽管是一个老问题,我还是会加我的意见。
我认为正确的答案取决于gcc编译器的错误消息,例如“缺少xxxx.h”
在某些情况下这可能会有所帮助:
sudo apt-get install build-essential python-dev
Despite being an old question, I’ll add my opinion.
I think the right answer depends on the error message of the gcc compiler, something like “Missing xxxx.h”
This might help in some cases:
sudo apt-get install build-essential python-dev
回答 11
以下答案对我有用,您可以尝试:
sudo apt-get install python3-lxml
below answer worked for me, you can try:
sudo apt-get install python3-lxml
回答 12
错误:错误:命令“ x86_64-linux-gnu-gcc”失败,退出状态为1
执行sudo apt-get install python-dev
解决了该错误。
Error : error: command ‘x86_64-linux-gnu-gcc’ failed with exit status 1
Executing sudo apt-get install python-dev
solved the error.
回答 13
在virtualenv
运行Python 3.5的情况下使用Ubuntu 14.04 LTS ,我必须这样做:
sudo apt-get install python3.5-dev
其他命令:
sudo apt-get install python-dev
sudo apt-get install python3-dev
没有帮助。我认为这是因为virtualenv
需要依赖系统范围的python-dev
软件包,并且它必须与virtualenv
的python版本匹配。但是,使用上述命令python-dev
将为python 2.x和Ubuntu 14.04随附的python 3.x(3.4,而非3.5)安装。
Using Ubuntu 14.04 LTS with a virtualenv
running python 3.5, I had to do:
sudo apt-get install python3.5-dev
The other commands:
sudo apt-get install python-dev
sudo apt-get install python3-dev
Did not help. I think this is because the virtualenv
needs to rely on the system-wide python-dev
package and it must match the virtualenv
‘s python version. However, using the above commands installs python-dev
for python 2.x and the python 3.x that comes with Ubuntu 14.04 which is 3.4, not 3.5.
回答 14
这对我有效,12.04,python2.7.6
sudo apt-get install libxml2 libxml2-dev libxslt1-dev
sudo apt-get install lxml
This works for me, 12.04, python2.7.6
sudo apt-get install libxml2 libxml2-dev libxslt1-dev
sudo apt-get install lxml
回答 15
这对我来说足够了:
sudo apt-get install build-essential
This was enough for me:
sudo apt-get install build-essential
回答 16
今天用pip升级我的计算机,并在此处查看其他答案后,我可以告诉您可能什么都没有。您应该逐个错误检查,以查找所需的特定库。就我而言,这些是我必须安装的库:
$ sudo apt-get install libssl-dev
$ sudo apt-get install libffi-dev
$ sudo apt-get install libjpeg-dev
$ sudo apt-get install libvirt-dev
$ sudo apt-get install libsqlite3-dev
$ sudo apt-get install libcurl4-openssl-dev
$ sudo apt-get install libxml2-dev libxslt1-dev python-dev
高温超导
After upgrade my computer with pip today, and check the other answers here, I can tell you that it could be ANYTHING. You should check error by error, looking for what’s the specific library that you need. In my case, these were the libraries that I had to install:
$ sudo apt-get install libssl-dev
$ sudo apt-get install libffi-dev
$ sudo apt-get install libjpeg-dev
$ sudo apt-get install libvirt-dev
$ sudo apt-get install libsqlite3-dev
$ sudo apt-get install libcurl4-openssl-dev
$ sudo apt-get install libxml2-dev libxslt1-dev python-dev
HTH
回答 17
提示:请不要将此作为答案。只是为了帮助别人。
安装psycopg2时遇到类似的问题。我装了build-essential
,python-dev
也libpq-dev
不过它抛出同样的错误。
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
由于我急于部署,所以最终只从@ user3440631的答案中复制了整行。
sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev
而且它就像一种魅力。但找不到哪个程序包解决了我的问题。如果有人psycopg2
从上面的命令中了解依赖包,请更新注释。
Tip: Please do not consider this as an answer. Just to help someone else too.
I had similar issue while installing psycopg2. I installedbuild-essential
, python-dev
and also libpq-dev
but it thrown same error.
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
As I was in hurry in deployment so finally just copied full line from
@user3440631’s answer.
sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev
And It worked like a charm. but could not find which package has resolved my issue.
Please update the comment if anyone have idea about psycopg2
dependancy package from above command.
回答 18
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
很多时间,我在安装M2Crypto
&pygraphviz
并安装批准的答案中提到的所有内容时遇到相同的错误。但这行也解决了我在批准的答案中使用其他软件包的所有问题。
sudo apt-get install libssl-dev swig
sudo apt-get install -y graphviz-dev
这swig
包救了我的生命,为解决方案M2Crypto
和graphviz-dev
为pygraphviz
。希望对您有所帮助。
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Lot of time I got the same error when installing M2Crypto
& pygraphviz
and installed all the things mention in the approved answer. But this below line solved all my problems with the other packages in approved answer too.
sudo apt-get install libssl-dev swig
sudo apt-get install -y graphviz-dev
This swig
package saved my life as the solution for M2Crypto
and graphviz-dev
for pygraphviz
. I hope this will help someone.
回答 19
对我来说,我必须确保使用的是正确的加密版本。pip.freeze有较旧的版本,并且在离开时我使用最新的问题。
For me I had to make sure I was using the correct version of cryptography.
pip.freeze had and older version and once I used the latest the problem when away.
回答 20
首先,您需要找出实际的问题是什么。您看到的是C编译器失败,但是您还不知道为什么。向上滚动到出现原始错误的位置。就我而言,尝试使用安装一些软件包pip3
,我发现:
Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-4u59c_8b/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-itjeh3va-record/install-record.txt --single-version-externally-managed --compile --user:
c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
所以就我而言,我需要安装libffi-dev
。
first you need to find out what the actual problem was. what you’re seeing is that the C compiler failed but you don’t yet know why. scroll up to where you get the original error. in my case, trying to install some packages using pip3
, I found:
Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-4u59c_8b/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-itjeh3va-record/install-record.txt --single-version-externally-managed --compile --user:
c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
so in my case I needed to install libffi-dev
.
回答 21
sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev
sudo easy_install greenlet
sudo easy_install gevent
sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-imaging python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev
sudo easy_install greenlet
sudo easy_install gevent
回答 22
当我在Ubuntu 14.04上遇到相同的问题时,以上答案均对我不起作用
但是,这解决了错误:
sudo apt-get install python-numpy libicu-dev
None of the above answers worked for me when I had the same issue on my Ubuntu 14.04
However, this solved the error:
sudo apt-get install python-numpy libicu-dev
回答 23
对我来说,它有助于安装libxml2-dev
和安装libxslt1-dev
。
sudo apt-get install libxml2-dev
For me it helped to install libxml2-dev
and libxslt1-dev
.
sudo apt-get install libxml2-dev
回答 24
我的堆栈是这样的:
> > ^
> > In file included from /usr/include/openssl/ssl.h:156:0,
> > from OpenSSL/crypto/x509.h:17,
> > from OpenSSL/crypto/crypto.h:17,
> > from OpenSSL/crypto/crl.c:3:
> > /usr/include/openssl/x509.h:751:15: note: previous declaration of ‘X509_REVOKED_dup’ was here
> > X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev);
> > ^
> > error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
> >
> > ---------------------------------------- Rolling back uninstall of > pyOpenSSL Command "/home/marta/env/pb/bin/python -u -c
> "import setuptools,
> > tokenize;__file__='/tmp/pip-build-14ekWY/pyOpenSSL/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n',
> > '\n');f.close();exec(compile(code, __file__, 'exec'))" install
> > --record /tmp/pip-2HERvW-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/marta/env/pb/include/site/python2.7/pyOpenSSL" failed with error
> > code 1 in /tmp/pip-build-14ekWY/pyOpenSSL/
在相同情况下,请考虑其中一个安装文件中的输入错误(错误),并通过将“ X509_REVOKED_dup”更改为“ X509_REVOKED_dupe”(无引号)进行手动编辑。我已经编辑了x509.h文件:
sed -e’s / X509_REVOKED_dup / X509_REVOKED_dupe / g’-i usr / include / openssl / x509.h
它对我有用,但是当他们编辑另一个文件时,请查阅下面链接的文章:
sed -e / X509_REVOKED_dup / X509_REVOKED_dupe / g’-i OpenSSL / crypto / crl.c
https://groups.google.com/forum/#!topic/kivy-users/Qt0jNIOACZc
My stack was like that:
> > ^
> > In file included from /usr/include/openssl/ssl.h:156:0,
> > from OpenSSL/crypto/x509.h:17,
> > from OpenSSL/crypto/crypto.h:17,
> > from OpenSSL/crypto/crl.c:3:
> > /usr/include/openssl/x509.h:751:15: note: previous declaration of ‘X509_REVOKED_dup’ was here
> > X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev);
> > ^
> > error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
> >
> > ---------------------------------------- Rolling back uninstall of > pyOpenSSL Command "/home/marta/env/pb/bin/python -u -c
> "import setuptools,
> > tokenize;__file__='/tmp/pip-build-14ekWY/pyOpenSSL/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n',
> > '\n');f.close();exec(compile(code, __file__, 'exec'))" install
> > --record /tmp/pip-2HERvW-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/marta/env/pb/include/site/python2.7/pyOpenSSL" failed with error
> > code 1 in /tmp/pip-build-14ekWY/pyOpenSSL/
in the same case, please consider the typo (bug) in one of the installation files and edit it manually by changing “X509_REVOKED_dup” to “X509_REVOKED_dupe” (no quotes). I have edited the x509.h file:
sed -e’s/X509_REVOKED_dup/X509_REVOKED_dupe/g’ -i
usr/include/openssl/x509.h
and it worked for me, but please consult with the post linked below, as they edited another file:
sed -e’s/X509_REVOKED_dup/X509_REVOKED_dupe/g’ -i OpenSSL/crypto/crl.c
https://groups.google.com/forum/#!topic/kivy-users/Qt0jNIOACZc
回答 25
就我而言,该命令sudo apt-get install unixodbc-dev
解决了该问题。我收到特定于sql.h头文件的错误。
In my case the command sudo apt-get install unixodbc-dev
resolved the issue. I was getting an error specific to the sql.h header file.
回答 26
对于Centos 7,使用以下命令安装Python开发包
Python 2.7
须藤百胜安装python-dev
Python 3.4
须藤百胜安装python34-devel
如果您的问题仍未解决,请尝试安装以下软件包-
sudo yum安装libffi-devel
须藤yum install openssl-devel
For Centos 7 Use below command to install Python Development Package
Python 2.7
sudo yum install python-dev
Python 3.4
sudo yum install python34-devel
Still if your problem not solved then try installing below packages –
sudo yum install libffi-devel
sudo yum install openssl-devel
回答 27
就像罗宾·温斯洛(Robin Winslow)在评论中说的那样:
我在这里找到了解决方案:stackoverflow.com/a/5178444/613540
就我而言,我完整的错误消息是:
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
我正在尝试安装torrench:
sudo python3 setup.py install
使用给定的stackoverflow链接,我可以通过以下方法解决此问题:
sudo apt install zlib1g-dev
请注意,已经安装了以下软件包:
libxslt1-dev is already the newest version.
python3-dev is already the newest version.
libxml2-dev is already the newest version.
希望对您有所帮助!
Like Robin Winslow says in a comment :
I found my solution over here: stackoverflow.com/a/5178444/613540
In my case, my complete error message was :
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
I was trying to install torrench :
sudo python3 setup.py install
With given stackoverflow link, I solve this issue by :
sudo apt install zlib1g-dev
Note that the following packages were already installed :
libxslt1-dev is already the newest version.
python3-dev is already the newest version.
libxml2-dev is already the newest version.
Hope that will help !
回答 28
在我的情况下,这是oursql
导致以下相同(通用)错误的原因。
In file included from oursqlx/oursql.c:236:0:
oursqlx/compat.h:13:19: fatal error: mysql.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for oursql
Running setup.py clean for oursql
所以,我知道我需要libmysqlcppconn-dev
包装。
sudo apt-get install libmysqlcppconn-dev
一切都很好!
In my case, it was oursql
that was causing the same(generic) error as below.
In file included from oursqlx/oursql.c:236:0:
oursqlx/compat.h:13:19: fatal error: mysql.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for oursql
Running setup.py clean for oursql
So, I knew that I need to have libmysqlcppconn-dev
package.
sudo apt-get install libmysqlcppconn-dev
And all good!
回答 29
这为我工作:
sudo apt安装zlib1g-dev
This Worked for me:
sudo apt install zlib1g-dev