我正在使用 cffi 将 Python 包装器写入 C 库。我无法编译库,distutils 抛出了一些神秘的东西distutils.errors.DistutilsPlatformError "\"GNU was unexpected at this time
Traceback (most recent call last):
File "pre.py", line 26, in <module>
ffi.compile()
File "C:\Python34\lib\site-packages\cffi\api.py", line 583, in compile
source_extension=source_extension, **kwds)
File "C:\Python34\lib\site-packages\cffi\recompiler.py", line 1227, in recompi
le
outputfilename = ffiplatform.compile('.', ext)
File "C:\Python34\lib\site-packages\cffi\ffiplatform.py", line 38, in compile
outputfilename = _build(tmpdir, ext)
File "C:\Python34\lib\site-packages\cffi\ffiplatform.py", line 62, in _build
dist.run_command('build_ext')
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\site-packages\setuptools\command\build_ext.py", line 49,
in run
_build_ext.run(self)
File "C:\Python34\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Python34\lib\distutils\command\build_ext.py", line 448, in build_exte
nsions
self.build_extension(ext)
File "C:\Python34\lib\site-packages\setuptools\command\build_ext.py", line 174
, in build_extension
_build_ext.build_extension(self, ext)
File "C:\Python34\lib\distutils\command\build_ext.py", line 503, in build_exte
nsion
depends=ext.depends)
File "C:\Python34\lib\distutils\msvc9compiler.py", line 460, in compile
self.initialize()
File "C:\Python34\lib\distutils\msvc9compiler.py", line 371, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Python34\lib\site-packages\setuptools\msvc9_support.py", line 52, in
query_vcvarsall
return unpatched['query_vcvarsall'](version, *args, **kwargs)
File "C:\Python34\lib\distutils\msvc9compiler.py", line 267, in query_vcvarsal
l
raise DistutilsPlatformError(stderr.decode("mbcs"))
distutils.errors.DistutilsPlatformError: "\"GNU was unexpected at this time.
Python 文档中没有关于此错误的任何信息。
我的设置如下:Windows 7 Visual Studio C++ 2010
在控制台中运行 python 输出这个
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
并且工具链环境变量设置正确
C:\Users\***>echo %VS100COMNTOOLS%
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
我很困惑,无法弄清楚这里发生了什么。