Linux使用python命令失败,关于python:安装脚本退出并显示错误:命令’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

谁能帮我解决这个问题?

有时它应该是你应该看到的错误。 它应该告诉你缺少什么包。

感谢您的评论dans。 我错过了tslibs。

请尝试查看给定错误上方的堆栈跟踪。 您可能会发现哪个包导致错误,然后查找该特定错误而不是此一般错误。

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.

输入:

$ sudo apt-get install python-dev

要么

# apt-get install python-dev

见http://www.cyberciti.biz/faq/debian-ubuntu-linux-python-h-file-not-found-error-solution/

这对我来说没有解决问题:Reading state information... Done python-dev is already the newest version.

@SummerSun如果你正在使用python3,你应该使用:$ sudo apt-get install python3-dev或$ sudo apt-get install python3.4-dev

@antoinet但我使用的是python 2.7.4 ...我很久以前就解决了这个问题,但我不记得任何特定的解决方案

绝对适合我:Ubuntu 16.04 64位; zshell + tmux

对于Python2.7,这适用于ansible安装。

"python-dev"的安装对我有所帮助。我正在通过pip install安装yara。谢谢!

对于python3.x,使用命令$ sudo apt-get install python3.x-dev

我在大学里遇到了同样的问题,为我最后一年的主要项目安装了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.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 2(2.7)与sudo apt-get install libffi-dev一起使用,我同意python3-dev for py34解决方案对我有用。

帮助python 3

这是正确的答案。

sudo apt-get install python3.6-dev为我解决了。因为我更新到3.6

适用于Python 2.7的解决方案适用于Ubuntu 14.04.1 LTS上的Python 2.7.6。完善!

如果我可以赞成它。

这些都没有解决我的问题。

感谢@Schtze的评论,但这不是问题的接受答案,我总是很乐意提供帮助,所以你可以告诉我你的错误,或者你可以尝试接受或其他解决方案,或提出一个问题Stackoverflow解决您的问题。

我另外使用apt-get install build-essential来解决我的问题。

这是最新的答案,+ 1,谢谢

帮助python 3.7

尝试安装这些包。

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

我没有找到任何关于为什么会发生此错误的合理答案!为什么我们需要安装所有这些软件包...如果可能的话请向我解释"'x86_64-linux-gnu-gcc'失败"给我

是的,其中一个软件包可能会修复它,但特别是知道哪个软件包会很好

我在这里找到了我的解决方案:stackoverflow.com/a/5178444/613540

在我的情况下,build-essential和python-dev就足够了。

因为没有回答这个问题而被倾倒。为什么我必须安装qt4-docs来解决这个问题?

build-essential和python-dev足以满足我的需求

如果我想在python 3.5.1上运行,我应该对所有包使用python3-吗?

唯一必要的是实际构建必需和python-dev

只需在ubuntu 14.4上安装这个软件包就可以解决这个问题:> sudo apt-get install build-essential autoconf libtool pkg-config python-opengl python-pyre虽然这个安装了"python-dev"作为下一个解决方案的依赖,但它可能会声称这个包就足够了

不适合我

sudo apt-get install python-dev解决了这个问题

我曾尝试使用build-essential和python-dev,但它没有工作,最后我只是复制了整行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而它的工作就像一个魅力:D

@ShaneReustle实际上是最后一个。嘿

不适合我(ubuntu 17.04)

我只做了第一个,我的问题解决了

答案没有给出问题的明确答案,只是要求用户在'希望'中安装一堆软件包,其中一个修复了你的问题。

只执行第一行解决了我的问题

您需要安装这些包:

sudo apt-get install libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev

这个对我有用。我从之前的答案中获得了所有python和构建包,我错过了这些lib *包。谢谢!

真棒!这适用于Ubuntu 16.04

这个在ubuntu 16.04中为我工作

ubuntu 17.04虚拟环境这很好用

工作在void linux上。

这很可能适用于干净的系统,但在我的情况下,我所缺少的是3个包:libldap2-dev,libpq-dev和libsasl2-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

或者尝试这个:

$ sudo apt-get install libxml2-dev libxslt1-dev

安装libxml2-dev和libxslt1-dev就可以了。

对于Python 3.4使用:

sudo apt-get install python3.4-dev

对于Ubuntu / Mint上的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

作为旁注,我只使用了sudo apt-get install python3.6-dev,它也有效。

那个很难的男孩 - 我在我的系统上安装了上面提到的所有东西,直到最后这个为我修好了。我正在使用带有python3.6的virtualenv。谢谢你。

对我来说,没有上述工作。但是,我解决了安装libssl-dev的问题。

sudo apt-get install libssl-dev

如果您有与我的情况相同的错误消息,这可能会有效:

fatal error: openssl/opensslv.h: No such file or directory ... ....

command 'x86_64-linux-gnu-gcc' failed with exit status 1

我也是。接受的答案似乎有点过分。

这对我来说也很有用,无需从接受的答案中下载一堆

当我在python中安装加密包时,通常会丢失这个库。

这对我来说也是个问题。我可以从stdout行告诉它"src / pycurl.h:164:28:致命错误:openssl / ssl.h:没有这样的文件或目录"在本帖子中出现问题的行之前打印"error:command'x86_64- linux-gnu-gcc'以退出状态1失败"

在我的情况下,它缺少包libffi-dev。

什么有效:

sudo apt-get install libffi-dev

在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

工作得很好

不仅这个解决方案帮助我修复了ffi.h缺少的依赖项,还帮助修复了其他缺少的依赖项。谢谢!

在我的情况下pip无法安装库,我尝试了上面给出的解决方案,但没有一个工作,但以下工作对我来说:

sudo apt upgrade gcc

你的意思是升级权利而不是更新......

通常这会在我们不使用环境时发生

尽管这是一个老问题,但我会加上我的观点。

我认为正确的答案取决于gcc编译器的错误信息,如"Missing xxxx.h"

在某些情况下这可能有所帮助:

sudo apt-get install build-essential python-dev

numpy如何引用此gcc错误?

Error : error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

执行sudo apt-get install python-dev解决了错误。

或者执行sudo apt-get install python3-dev。

以下答案对我有用,你可以尝试:

sudo apt-get install python3-lxml

而对于python2:sudo apt-get install python-lxml

这适用于我,12.04,python2.7.6

sudo apt-get install libxml2 libxml2-dev libxslt1-dev

sudo apt-get install lxml

E: Unable to locate package lxml我得到以下内容。 :(

@kRazzyR尝试运行sudo apt-get install python-lxml命令

使用运行python 3.5的virtualenv的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 2.x安装python-dev,为Ubuntu 14.04安装python 3.x,它是3.4,而不是3.5。

提示:请不要将此视为答案。只是为了帮助别人。

我在安装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 dependancy package,请更新评论。

我通过在CentOS上安装postgresql-devel包解决了我的psycopg2问题。

今天用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

HTH

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

首先,你需要找出实际问题是什么。你看到的是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('

', '

'), __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

^

compilation terminated.

所以在我的情况下,我需要安装libffi-dev。

当然,这个问题上出现的编译错误是非常相对的。例如,我的情况就像你的情况一样:我正在通过pip3安装bcrypt,并且输出非常大并且观察来自pip3 install bcrypt的第一条消息,我意识到libffi-dev是导致的包安装过程的下一步所有麻烦。好的观察,朋友:)。我希望你不要忘记,如果我给你的答案一些分数,对我来说,值得更好的考虑。问候。

对我来说,我必须确保使用正确版本的加密。

pip.freeze有和旧版本,一旦我使用了最新的问题。

对我来说,它有助于安装libxml2-dev和libxslt1-dev。

sudo apt-get install libxml2-dev

我的堆栈是这样的:

> >                            ^

> >     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('

',

> > '

');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/

在相同的情况下,请考虑其中一个安装文件中的拼写错误(bug),并通过将"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's/X509_REVOKED_dup/X509_REVOKED_dupe/g' -i OpenSSL/crypto/crl.c

https://groups.google.com/forum/#!topic/kivy-users/Qt0jNIOACZc

当我在Ubuntu 14.04上遇到同样的问题时,上述答案都不适用于我

但是,这解决了错误:

sudo apt-get install python-numpy libicu-dev

Odoo不依赖于python-numpy。

这是Ubuntu 16.04中唯一适用的解决方案

在我的情况下,命令sudo apt-get install unixodbc-dev解决了这个问题。我收到特定于sql.h头文件的错误。

对于Centos 7使用以下命令安装Python开发包

Python 2.7

sudo yum install python-dev

Python 3.4

sudo yum install python34-devel

如果您的问题没有解决,请尝试安装以下包 -

sudo yum install libffi-devel

sudo yum install openssl-devel

这对我有用:

sudo apt install zlib1g-dev

就我而言,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

一切都好!

总的来说,我后来检查了我们的mysql包的setup.py文件,发现它使用了mysqld,因此我安装了sudo apt-get install libmysqld-dev,它对我有用。

我们的安装问题的macOS解决方案:askubuntu.com/questions/663919/

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。我希望这会对某人有所帮助。

就像罗宾温斯洛在评论中所说:

I found my solution over here: 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.

希望有所帮助!

就我而言,我不得不降级该项目的Python版本,因为该模块不支持最新版本的Python。我已经测试了上面的所有答案但没有奏效。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值