Python 2.7.9 安装 esmre 时出现错误“cl.exe"失败,退出状态为 2 [英] Python 2.7.9 install esmre with error 'cl.exe' failed with exit status 2

查看:65
本文介绍了Python 2.7.9 安装 esmre 时出现错误“cl.exe"失败,退出状态为 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Windows 8 和 Python 2.7.9.我尝试使用 pip 安装 esmre,但出现以下错误:

I am using Windows 8 and Python 2.7.9. I tried to install esmre with pip, but have the following error:

src/aho_corasick.c(48):致命错误 C1083:无法打开包含文件:'stdbool .h':没有这样的文件或目录错误:命令'C:\Users\CHALLEN QU\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe' 失败并退出状态 2

src/aho_corasick.c(48) : fatal error C1083: Cannot open include file: 'stdbool .h': No such file or directory error: command 'C:\Users\CHALLEN QU\AppData\Local\Programs\Common\Micro soft\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2

esmre 的构建轮失败
构建 esmre 失败

Failed building wheel for esmre
Failed to build esmre

<小时>

我已经尝试过的事情:


Things I have already tried:

  1. 重新安装适用于 Python 2.7 的 Microsoft Visual C++ 编译器
  2. 升级pipsetuptools
  3. 寻找esmre的编译版本,我没有找到
  4. 使用 easy_install 或包内的 setup.py 安装 esmre.
  1. Reinstall Microsoft Visual C++ compiler for Python 2.7
  2. Upgrade pip and setuptools
  3. Look for a compiled version of esmre, which I have not found
  4. Install esmre with easy_install or the setup.py inside the package.

好像编译不出来.

推荐答案

"stdbool.h" 不是 C++ 标头和 Visual 2010 不支持 C99.

"stdbool.h" is not a C++ header and Visual 2010 doesn't support C99.

作为一种解决方法,您可以找到 Visual 的include"目录并添加具有以下内容的stdbool.h"文件:

As a workaround you could locate Visual's "include" directory and add "stdbool.h" file with the following contents:

typedef int bool;
#define false 0
#define true 1

此答案

#pragma once

#define false   0
#define true    1

#define bool int

来自这个答案.

链接线程中的另一种解决方法是使用不同的编译器.

Another workaround in the linked thread is to use a different compiler.

这篇关于Python 2.7.9 安装 esmre 时出现错误“cl.exe"失败,退出状态为 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆