命令“x86_64-linux-gnu-gcc”失败,退出状态为1

2ul0zpep  于 2023-03-29  发布在  Linux
关注(0)|答案(4)|浏览(239)

我尝试安装“学术”包,但我一直收到这个错误:

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c build/temp.linux-x86_64-2.7/_openssl.c -o build/temp.linux-x86_64-2.7/build/temp.linux-x86_64-2.7/_openssl.o
build/temp.linux-x86_64-2.7/_openssl.c:434:30: fatal error: openssl/opensslv.h: No such file or directory
compilation terminated.

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

Command "/usr/bin/python -u -c "import setuptools,tokenize;__file__='/tmp/pip-build-0OXGEx/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-EdgZGB-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-0OXGEx/cryptography/

已经尝试了以下帖子中的解决方案,但不起作用:
pip install lxml error

tcomlyy6

tcomlyy61#

我也遇到过同样的问题。这一个帮助了我:

sudo apt-get install build-essential libssl-dev libffi-dev python3-dev

如果您使用的是python2,请尝试将python3-dev替换为python-dev

3npbholx

3npbholx2#

在新创建的python 3.6虚拟环境中,尝试运行我的模块的setup.py,以下命令解决了错误,
sudo apt-get install python3.6-dev
对我来说错误在于,

... Python.h: No such file or directory
18 | #include "Python.h"
  |          ^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

其余的软件包build-essential libssl-dev libffi-dev已经从以前的时间安装。

fnvucqvd

fnvucqvd3#

安装lib 32 ncurses 5-dev:

sudo apt-get install lib32ncurses5-dev
bnlyeluc

bnlyeluc4#

在我的例子中,例外是:

例外情况:

#include <snappy-c.h>
          ^~~~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit
status 1

我通过安装这些库解决了这个问题:

sudo apt-get install libsnappy-dev

pip3 install python-snappy

Here很好地解释了异常的原因以及如何消除它。

相关问题