python - 如何配置 python cffi 库以使用 mingw?

标签 python mingw python-cffi

尝试在 Windows 上调用 cffi.FFI.verify() 将产生此错误:

distutils.errors.DistutilsPlatformError: Unable to find vcvarsall.bat

我想用mingw编译而不是msvc。我试图通过创建 c:\Python27\Lib\distutils\distutils.cfg 来让 distutils 使用 mingw

[build]
compiler = mingw32

但这似乎并不影响 cffi,我仍然得到 vcvarsall.bat missing 错误。

那么我怎样才能使 cffi 使用 gcc/mingw(或一般其他 C 编译器)?

最佳答案

尝试重新安装 cffi,现在 distutils 已正确配置。 例如使用 easy_install

easy_install cffi

或者甚至使用 MinGW 以这种方式从源代码重建和安装它:

cd cffi-src-dir
python setup.py config --compiler=mingw32 build --compiler=mingw32 install
cd ..

这将确保 cffi 被正确设置为与 MinGW 一起使用...我猜...

关于python - 如何配置 python cffi 库以使用 mingw?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16787649/

相关文章:

python - 对 "list"列表中的元素求和,每个元素具有不同的索引

python - 给定源代码,如何使用 CFFI 调用现有的 C 函数?

python - 用python调用多个过程

python - 将 SqlAlchemy 集成到 Django 项目中的最佳方式

python - 带有 re.search() 的原始字符串?

c++ - 如何使用 MinGW 编译器在 Windows 命令提示符下使用 Makefile 编译代码?

c++ - 包含库中的外部变量

c++ - 用 C/C++ 编译一个 DLL,然后从另一个程序调用它

python - 如何将 numpy ND 数组转换为 CFFI C++ 数组并再次转换回来?

python - 如何通过 pip 安装 cairocffi?