f2py无法运行 - CompaqVisualFCompiler中出错,未安装compaq编译器

时间:2017-12-05 18:38:37

标签: python windows fortran mingw f2py

我试图使用f2py(在anaconda 2,windows 7 64bit,python 2.7.13下),但我反复遇到以下错误,即使只是尝试列出可用的编译器:

(C:\Users\UserName\Anaconda2) C:\Users\UserName\Desktop\fortran>f2py -c --help-fco
mpiler

(C:\Users\UserName\Anaconda2) C:\Users\UserName\Desktop\fortran>call "C:\Users\UserName\
Anaconda2\Scripts\\..\python.exe" "C:\Users\UserName\Anaconda2\Scripts\\f2py
.py" -c --help-fcompiler
Unexpected ValueError in C:\Users\UserName\Anaconda2\lib\site-packages\numpy\dist
utils\fcompiler\compaq.pyc
Traceback (most recent call last):
  File "C:\Users\UserName\Anaconda2\Scripts\\f2py.py", line 28, in <module>
    main()
  File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\f2py\f2py2e.py", line
 648, in main
    run_compile()
  File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\f2py\f2py2e.py", line
 633, in run_compile
    setup(ext_modules=[ext])
  File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\distutils\core.py", l
ine 169, in setup
    return old_setup(**new_attr)
  File "C:\Users\UserName\Anaconda2\lib\distutils\core.py", line 137, in setup
    ok = dist.parse_command_line()
  File "C:\Users\UserName\Anaconda2\lib\distutils\dist.py", line 467, in parse_co
mmand_line
    args = self._parse_command_opts(parser, args)
  File "C:\Users\UserName\Anaconda2\lib\distutils\dist.py", line 576, in _parse_c
ommand_opts
    func()
  File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\distutils\command\con
fig_compiler.py", line 15, in show_fortran_compilers
    show_fcompilers(dist)
  File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\distutils\fcompiler\_
_init__.py", line 882, in show_fcompilers
    load_all_fcompiler_classes()
  File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\distutils\fcompiler\_
_init__.py", line 740, in load_all_fcompiler_classes
    __import__ (module_name)
  File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\distutils\fcompiler\c
ompaq.py", line 57, in <module>
    class CompaqVisualFCompiler(FCompiler):
  File "C:\Users\UserName\Anaconda2\lib\site-packages\numpy\distutils\fcompiler\c
ompaq.py", line 100, in CompaqVisualFCompiler
    raise e
ValueError: [u'path', u'include']

(C:\Users\UserName\Anaconda2) C:\Users\UserName\Desktop\fortran>

我为anaconda安装了minGW(通过conda install mingw),因此 应检测并运行它。我不太确定,但似乎它试图找到康柏而不是那个?这里是compaq.py的相关部分(第100行是最后一行):

if sys.platform=='win32':
        from numpy.distutils.msvccompiler import MSVCCompiler

        try:
            m = MSVCCompiler()
            m.initialize()
            ar_exe = m.lib
        except DistutilsPlatformError:
            pass
        except AttributeError:
            msg = get_exception()
            if '_MSVCCompiler__root' in str(msg):
                print('Ignoring "%s" (I think it is msvccompiler.py bug)' % (msg))
            else:
                raise
        except IOError:
            e = get_exception()
            if not "vcvarsall.bat" in str(e):
                print("Unexpected IOError in", __file__)
                raise e
        except ValueError:
            e = get_exception()
            if not "path']" in str(e):
                print("Unexpected ValueError in", __file__)
                raise e

0 个答案:

没有答案