【问题标题】:command 'x86_64-linux-gnu-gcc' failed with exit status 1命令“x86_64-linux-gnu-gcc”失败,退出状态为 1
【发布时间】:2017-05-20 11:01:26
【问题描述】:

我尝试安装“scholarly”包,但一直收到此错误:

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

【问题讨论】:

  • 你在运行什么命令?
  • 您缺少 ssl 开发包中的文件:sudo apt-get update && sudo apt-get install libssl-dev 来获取它们。可能会有其他依赖项。
  • pip install 学术@jmd_dk
  • 没有工作@tdelaney

标签: python linux gcc ubuntu-16.04


【解决方案1】:

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

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

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

【讨论】:

  • 仅供参考:我遇到了 exact 相同的问题,单独安装 libssl-dev 就足以为我解决这个问题。从apt 获取python-dev 通常是个好主意。 也就是说:如果您使用 Anaconda 或其他一些 python-environment-engine,请注意不要通过安装 python-dev 弄乱您的 $PATH。
  • @Dana Friedlander:它解决了我的问题。酷..谢谢!!
  • 关于python3-dev 的小评论对我很有帮助。谢谢!
  • 谢谢,我在安装psutil时遇到了同样的问题,这解决了python3
  • 运行 sudo apt update 如果您在服务器上遇到此问题
【解决方案2】:

安装 lib32ncurses5-dev:

sudo apt-get install lib32ncurses5-dev

【讨论】:

    【解决方案3】:

    就我而言,例外是:

    例外:

    #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 很好地解释了异常的原因以及我们如何摆脱它。

    【讨论】:

      【解决方案4】:

      在一个新创建的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 之前已经安装了。

      【讨论】:

      • 这为我解决了这个问题。我的错误是相同的,但发生在我为 pdf 解析器安装 pyvoronoi 模块时。
      猜你喜欢
      • 2016-01-08
      • 2022-12-03
      • 2016-04-18
      • 2021-11-07
      • 1970-01-01
      • 2016-08-27
      • 2015-01-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多