编译f2py代码时找不到vscvarsall.bat

问题描述 投票:0回答:1

我正在尝试使用以下python脚本(称为build_f2py_modules.py)编译一些f2py代码,正如我的教授所说,我使用的是python 3.6和Windows 10 64位:

from numpy.distutils.core import Extension
ext = Extension(name='Test',
    sources=['Sigma.f95'])

if __name__ == '__main__':
    from numpy.distutils.core import setup
    setup(name='f2py_example',
        ext_modules =[ext])

然后使用以下命令在命令提示符下运行它:

python build_f2py_modules.py build_ext

我收到以下错误:

running build_ext
running build_src
build_src
building extension "Test" sources
f2py options: []
  adding 'build\src.win-amd64-3.6\build\src.win-amd64-3.6\fortranobject.c' to sources.
  adding 'build\src.win-amd64-3.6\build\src.win-amd64-3.6' to include_dirs.
build_src: building npy-pkg config files
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Found executable C:\MinGW\bin\gfortran.exe
customize Gnu95FCompiler
customize Gnu95FCompiler using build_ext
building 'Test' extension
compiling C sources
error: Unable to find vcvarsall.bat

我必须下载什么吗?任何帮助将非常感激

python fortran f2py
1个回答
1
投票

看起来好像它想要Microsoft Visual C ++而gcc不会这样做。您可以下载VS2017 Community Edition,确保执行非默认安装并选择C ++组件。 https://software.intel.com/en-us/articles/intel-c-fortran-compilers-for-windows-integration-into-microsoft-visual-studio-2017在英特尔编译器的背景下讨论了这一点,但VS配置信息也是相关的。

© www.soinside.com 2019 - 2024. All rights reserved.