带有mingw的numpy构建在带有AttributeError的Window上失败:Mingw32CCompiler实例没有属性'compile_options',如何解决这个问题?

时间:2015-12-07 11:17:47

标签: python windows numpy

我已经从git-hub下载了numpy源代码,我也安装了mingw并且在Windows上设置了所有路径,我可以使用mingw编译C文件,所以这也有效。
我正按照scipy website的说明进行操作,其中python.exe setup.py config --compiler=mingw32 build --compiler=mingw32 bdist_wininst已编译一段时间然后突然停止 -

gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -Inumpy\core\src\private -Inu
mpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -IC:\python27\include -IC:\python27\PC -c _configtest.c -o _configtest.o
_configtest.c: In function 'main':
_configtest.c:7:12: error: 'Py_UNICODE_WIDE' undeclared (first use in this function)
     (void) Py_UNICODE_WIDE;
            ^~~~~~~~~~~~~~~

_configtest.c:7:12: note: each undeclared identifier is reported only once for each function it appears in failure.
removing: _configtest.c _configtest.o
.
.
.
.
  File "D:\pylibs\numpy-master\numpy\distutils\command\build_src.py", line 386, in generate_sources
    source = func(extension, build_dir)
  File "numpy\core\setup.py", line 443, in generate_config_h
    rep = check_long_double_representation(config_cmd)
  File "numpy\core\setup_common.py", line 194, in check_long_double_representation
    cmd.compiler.compile_options.remove("/GL")
AttributeError: Mingw32CCompiler instance has no attribute 'compile_options'

如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

在您的发行版中,在文件numpy \ core \ setup_common.py的第194行添加以下代码并重建。它应该允许你构建。

  SELECT
    E.Visitor Toilet_Type,
    SUM(case when SE.SemiEnragedPotty_ID is not null and
        M.Toilet_ID is not null then 1 else 0 end) MANUAL_PORTA_POTTY,
    SUM(case when R.Toilet_ID is not null then 1 else 0 end) REGULAR_PORTA_POTTY
  FROM 
    BORE.EnragedPotty E,
    BORE.SemiEnragedPotty SE,
    BORE.ManualPotty M,
    BORE.RegularPotty R
  WHERE
    E.SemiEnragedPotty_ID = SE.SemiEnragedPotty_ID (+) AND
    E.Toilet_ID = M.Toilet_ID (+)
    E.Toilet_ID = R.Toilet_ID (+)
  GROUP BY Visitor
  ORDER BY Visitor ASC