当我尝试安装doo-server时,我得到了以下错误:

error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

有人能帮我解决这个问题吗?


当前回答

TL;DR:执行如下命令

sudo apt-get install python2-dev gcc

我在尝试pip安装python2.7的模块时遇到了这个问题。

很多答案提到,解决这个问题的方法是sudo apt-get install python-dev。然而,这对我不起作用,因为包裹没有找到。然而,这条评论顶部显示的命令存在,我最终能够pip安装模块。

其他回答

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

我在这里找到了解决方案: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

我试图安装洪流:

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.

希望对大家有所帮助!

$ 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 libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev libjpeg-dev zlib1g-dev

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

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