【问题标题】:Error command 'gcc' failed with exit status 1错误命令“gcc”失败,退出状态为 1
【发布时间】:2014-03-17 12:54:58
【问题描述】:

我在 Windows 7 64 位上安装了 Scrapy。当我在 CMD 中输入scrapy startproject tutorial 时,我得到一个错误:

ImportError: No module named `cryptography.hazmat.bindings.openssl.binding`

为了解决这个问题,我想安装 pycrypto。当我运行pip install pycrypto 时,下一个错误是:_Unable to findvcvarsall.bat_,因为我已经安装了 Visual Studio 2010,为了解决这个问题,我安装了 mingw32 并设置了环境变量并禁用了我的防病毒软件并删除了-mno-cygwin来自cygwinccompiler.py

if self.gcc_version < '4' or is_cygwingcc():
    no_cygwin = ''
else:
    no_cygwin = ' -mno-cygwin'

成为:

if self.gcc_version < '4' or is_cygwingcc():
    no_cygwin = ''
else:
    no_cygwin = ''

现在我得到了错误:

error command 'gcc' failed with exit status 1

(已安装python 2.7 64)

请指导我。

【问题讨论】:

  • 该行之前应该会显示一条很长的错误消息:请复制它的最后一块,因为那里的某处包含您的 actual 错误(退出状态为 1 失败是只是一般信息)。最后 50 行可能会这样做。
  • 愚蠢的问题:你的系统路径上有gcc吗?
  • build\temp.win-amd64-2.7\Release\src\winrand.o:winrand.c:(.text+0x47d): undefine d reference to `_imp__PyErr_Format' collect2: ld 返回 1 exit状态警告:未找到 GMP 或 MPIR 库;不构建 Crypto.PublicKey._fastmath。错误:命令“gcc”失败,退出状态为 1

标签: python python-2.7 gcc


【解决方案1】:

简单的事情就是从http://www.voidspace.org.uk/python/modules.shtml#pycrypto安装二进制构建

然后您可以在闲暇时再次尝试构建 PyCrypto C 扩展:

  • Visual Studio 附带一个 CMD 快捷方式 vcvarsall.bat。使用该快捷方式启动 cmd.exe 并从那里运行 pip install
  • (或者)安装 cygwin 而不是 mingw 以避免更改 PyCrypto 的构建脚本
  • Pycrypto 依赖于 either GMP or MPIR 的 bignums。 Cygwin 提供了这些的预编译二进制文件。我确信有基于 Mingw 的项目也预编译了 GMP。
  • 您需要为 Pycrypto 的依赖项获取预构建的二进制文件和标头,或者自己手动构建它们

【讨论】:

  • 我为 Python 2.7 64bit 安装 PyCrypto 2.6,但是当我在 CMD 中输入 scrapy startproject 教程时,我得到一个错误:ImportError: No module named cryptography.hazmat.bindings.openssl.binding
  • 您可以获取/产品 Windows x64 版本的 GMP 库和头文件,然后构建 Pycrypto,或者您可以切换到使用 32 位版本的 Python 并使用 voidspace 预构建的 Pycrypto 二进制文件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-08
  • 2013-11-26
  • 2011-11-11
  • 2018-09-21
  • 2012-03-15
相关资源
最近更新 更多