使用f2py的错误

时间:2015-07-14 16:37:34

标签: python f2py

我是Python的新手(约4个月),我试图在python中使用一些Fortran子程序,但我在使用f2py时遇到了重大问题。我查看了文档,但无法弄清楚为什么我会收到我所得到的错误。我创建了一个小的Fortran文件hello.f

C File hello.f
      subroutine foo (a)
      integer a
      print*, "Hello from Fortran!"
      print*, "a=",a
      end

从命令行我尝试使用命令:

f2py -c -m hello hello.f

但是我得到了这个输出:

F:\home\tsansom\Projects\PyTxBLEND>f2py -c -m hello hello.f
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "hello" sources
f2py options: []
f2py:> c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7\hellomodule.c
creating c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7
Reading fortran codes...
    Reading file 'hello.f' (format:fix,strict)
Post-processing...
    Block: hello
                    Block: foo
Post-processing (stage 2)...
Building modules...
    Building module "hello"...
            Constructing wrapper function "foo"...
              foo(a)
    Wrote C/API module "hello" to file "c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7\hellomodule.c"
adding 'c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7\fortranobject.c' to sources.
adding 'c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7' to include_dirs.
copying C:\Anaconda\lib\site-packages\numpy\f2py\src\fortranobject.c -> c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7
copying C:\Anaconda\lib\site-packages\numpy\f2py\src\fortranobject.h -> c:\users\tsansom\appdata\local\temp\tmpt8nrxn\src.win-amd64-2.7
build_src: building npy-pkg config files
running build_ext
No module named msvccompiler in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
Unexpected ValueError in C:\Anaconda\lib\site-packages\numpy\distutils\fcompiler\compaq.pyc
Traceback (most recent call last):
  File "C:\Anaconda\Scripts\f2py-script.py", line 23, in <module> 
    main()
  File "C:\Anaconda\lib\site-packages\numpy\f2py\f2py2e.py", line 590, in main
    run_compile()
  File "C:\Anaconda\lib\site-packages\numpy\f2py\f2py2e.py", line 576, in run_compile
    setup(ext_modules = [ext])
  File "C:\Anaconda\lib\site-packages\numpy\distutils\core.py", line 169, in setup
    return old_setup(**new_attr)
  File "C:\Anaconda\lib\distutils\core.py", line 151, in setup
    dist.run_commands()
  File "C:\Anaconda\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Anaconda\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Anaconda\lib\site-packages\numpy\distutils\command\build.py", line 39, in run
    old_build.run(self)
  File "C:\Anaconda\lib\distutils\command\build.py", line 127, in run
    self.run_command(cmd_name)
  File "C:\Anaconda\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "C:\Anaconda\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Anaconda\lib\site-packages\numpy\distutils\command\build_ext.py", line 195, in run
    c_compiler=self.compiler)
  File "C:\Anaconda\lib\site-packages\numpy\distutils\fcompiler\__init__.py", line 837, in new_fcompiler
    load_all_fcompiler_classes()
  File "C:\Anaconda\lib\site-packages\numpy\distutils\fcompiler\__init__.py", line 740, in load_all_fcompiler_classes
    __import__ (module_name)
  File "C:\Anaconda\lib\site-packages\numpy\distutils\fcompiler\compaq.py", line 57, in <module>
    class CompaqVisualFCompiler(FCompiler):
  File "C:\Anaconda\lib\site-packages\numpy\distutils\fcompiler\compaq.py", line 100, in CompaqVisualFCompiler
    raise e
ValueError: [u'path', u'lib']

任何人都知道这个错误意味着什么?不可否认,我不知道自己在做什么,但我还在努力学习。在此先感谢您的帮助,我们非常感谢。感谢

0 个答案:

没有答案