无法在Windows上运行f2py

时间:2015-04-02 12:28:57

标签: python windows fortran f2py

我在Windows 7机器上安装了Python 2.7,Numpy和gfortran。

正在运行

python c:\Python27\Scripts\f2py.py -c --fcompiler=gnu95 --compiler=mingw32 -m hello hello.f

给出错误

objdump.exe: 'C:\WINDOWS\system32\python27.dll': No such file

确实存在文件c:\ MinGW64 \ bin \ python27.dll,但我无法将其复制到C:\ WINDOWS \ system32。该目录是写保护的。

完整输出

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\myname\appdata\local\temp\tmp2pepoe\src.win-amd64-2.7\hellomodule.c
creating c:\users\myname\appdata\local\temp\tmp2pepoe
creating c:\users\myname\appdata\local\temp\tmp2pepoe\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\myname\appdata\local\temp\tmp2pepoe\src.win-amd64-2.7\hellomodule.c"
  adding 'c:\users\myname\appdata\local\temp\tmp2pepoe\src.win-amd64-2.7\fortranobject.c' to sources.
  adding 'c:\users\myname\appdata\local\temp\tmp2pepoe\src.win-amd64-2.7' to include_dirs.
copying c:\python27\lib\site-packages\numpy\f2py\src\fortranobject.c -> c:\users\myname\appdata\local\temp\tmp2pepoe\src.win-amd64-2.7
copying c:\python27\lib\site-packages\numpy\f2py\src\fortranobject.h -> c:\users\myname\appdata\local\temp\tmp2pepoe\src.win-amd64-2.7
build_src: building npy-pkg config files
running build_ext
Looking for python27.dll
Building import library (arch=AMD64): "c:\python27\libs\libpython27.a" (from C:\WINDOWS\system32\python27.dll)
objdump.exe: 'C:\WINDOWS\system32\python27.dll': No such file
Traceback (most recent call last):
  File "c:\Python27\Scripts\f2py.py", line 24, in <module>
    main()
  File "c:\python27\lib\site-packages\numpy\f2py\f2py2e.py", line 588, in main
    run_compile()
  File "c:\python27\lib\site-packages\numpy\f2py\f2py2e.py", line 574, in run_compile
    setup(ext_modules = [ext])
  File "c:\python27\lib\site-packages\numpy\distutils\core.py", line 186, in setup
    return old_setup(**new_attr)
  File "c:\python27\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "c:\python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "c:\python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "c:\python27\lib\site-packages\numpy\distutils\command\build.py", line 37, in run
    old_build.run(self)
  File "c:\python27\lib\distutils\command\build.py", line 127, in run
    self.run_command(cmd_name)
  File "c:\python27\lib\distutils\cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "c:\python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "c:\python27\lib\site-packages\numpy\distutils\command\build_ext.py", line 92, in run
    force=self.force)
  File "c:\python27\lib\site-packages\numpy\distutils\ccompiler.py", line 556, in new_compiler
    compiler = klass(None, dry_run, force)
  File "c:\python27\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 91, in __init__
    build_import_library()
  File "c:\python27\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 299, in build_import_library
    return _build_import_library_amd64()
  File "c:\python27\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 320, in _build_import_library_amd64
    generate_def(dll_file, def_file)
  File "c:\python27\lib\site-packages\numpy\distutils\mingw32ccompiler.py", line 269, in generate_def
    if i == len(dump):
UnboundLocalError: local variable 'i' referenced before assignment

0 个答案:

没有答案