numpy - numpy安装错误。 (Mingw32CCompiler实例没有属性 'compile_options')

标签 numpy theano

我在Windows8 / Anaconda spyder(2.7)中使用python
我正在尝试更新Theano的最新信息。当我通过安装theano时

"pip install --upgrade theano"

该错误发生在numpy安装部分。

尽管numpy可在anaconda GUI中使用,但在anaconda终端中未显示。 (pip show numpy不输出任何内容)

错误如下所示(当我尝试安装numpy时,会发生相同的错误)
  File "c:\users\user\appdata\local\temp\pip_build_user\numpy\numpy\distutils\command\build_src.py", line 329, in build_extension_sources

    sources = self.generate_sources(sources, ext)

  File "c:\users\user\appdata\local\temp\pip_build_user\numpy\numpy\distutils\command\build_src.py", line 386, in generate_sources

    source = func(extension, build_dir)

  File "numpy\core\setup.py", line 455, in generate_config_h

    rep = check_long_double_representation(config_cmd)

  File "numpy\core\setup_common.py", line 191, in check_long_double_representation

    cmd.compiler.compile_options.remove("/GL")

AttributeError: Mingw32CCompiler instance has no attribute 'compile_options'

----------------------------------------
Cleaning up...
  Removing temporary dir c:\users\user\appdata\local\temp\pip_build_user...
Command C:\Anaconda\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\user\\appdata\\local\\temp\\pip_build_user\\numpy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\user\appdata\local\temp\pip-nm4fpu-record\install-record.txt --single-version-externally-managed --compile failed with error code 1 in c:\users\user\appdata\local\temp\pip_build_user\numpy
Exception information:
Traceback (most recent call last):
  File "C:\Anaconda\lib\site-packages\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "C:\Anaconda\lib\site-packages\pip\commands\install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "C:\Anaconda\lib\site-packages\pip\req.py", line 1435, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "C:\Anaconda\lib\site-packages\pip\req.py", line 706, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "C:\Anaconda\lib\site-packages\pip\util.py", line 697, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command C:\Anaconda\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\user\\appdata\\local\\temp\\pip_build_user\\numpy\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\user\appdata\local\temp\pip-nm4fpu-record\install-record.txt --single-version-externally-managed --compile failed with error code 1 in c:\users\user\appdata\local\temp\pip_build_user\numpy

最佳答案

这很可能是一个小问题。不幸的是,即使在我建议修复后,我也无法升级theano,但是遵循this one这样的逐步指南可能会起作用。

发生此特定问题是因为numpy.distutils.misc_util.mingw32()不应该返回False。另请参见this discussionthe source 。我决定手动将系统变量MSYSTEM设置为MINGW32,该变量在我的系统中未定义,但我发现它不太可能破坏任何其他行为。

就像我说的那样,这不能保证升级会起作用,也不能保证没有副作用,但是它将解决这里提到的问题。

关于numpy - numpy安装错误。 (Mingw32CCompiler实例没有属性 'compile_options'),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33886558/

相关文章:

python - Theano 逻辑回归维度不匹配

python - 当 channel 数增加时,ResNet 快捷连接的零填充

python - 使用 Numpy 和 Pandas 优化 Python 代码

python - 何时使用 numpy.random.randn(...) 以及何时使用 numpy.random.rand(...)?

python - 如何将整个keras模型变成theano函数

neural-network - 如何正确添加和使用BatchNormLayer?

python - 多个 for 循环以更 Pythonic 的方式相互依赖

python - 将此函数绘制为累积分布图

python - 当 io.py 在同一目录中时,pandas ImportError C 扩展

python - Theanos安装报错linux编译报错