Python 创建并立即覆盖临时文件

Python 创建并立即覆盖临时文件,python,f2py,Python,F2py,我最近在我的计算机上安装了python和numpy,我有一个被f2py识别的fortran编译器。然而,当我试图运行一个非常简单的f2py实例时,一切都糟透了。从错误消息来看,f2py似乎正在创建写出翻译后的C/API所需的临时文件,但随后它覆盖了这些文件,我得到了下面的错误消息。fortran代码是自己编译的 running build running config_cc unifing config_cc, config, build_clib, build_ext, build comma

我最近在我的计算机上安装了python和numpy,我有一个被f2py识别的fortran编译器。然而,当我试图运行一个非常简单的f2py实例时,一切都糟透了。从错误消息来看,f2py似乎正在创建写出翻译后的C/API所需的临时文件,但随后它覆盖了这些文件,我得到了下面的错误消息。fortran代码是自己编译的

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 "fibl" sources
f2py options: []
f2py:> /tmp/tmpjxR2Ko/src.linux-i686-2.7/fiblmodule.c
creating /tmp/tmpjxR2Ko
creating /tmp/tmpjxR2Ko/src.linux-i686-2.7
Reading fortran codes...
Reading file 'fibl.f' (format:fix,strict)
Post-processing...
Block: fibl
        Block: fib
Post-processing (stage 2)...
Building modules...
Building module "fibl"...
    Constructing wrapper function "fib"...
      fib(a,[n])
Wrote C/API module "fibl" to file "/tmp/tmpjxR2Ko/src.linux-i686-2.7/fiblmodule.c"
adding '/tmp/tmpjxR2Ko/src.linux-i686-2.7/fortranobject.c' to sources.
adding '/tmp/tmpjxR2Ko/src.linux-i686-2.7' to include_dirs.
copying /usr/lib/pymodules/python2.7/numpy/f2py/src/fortranobject.c -> /tmp/tmpjxR2Ko/src.linux-i686-2.7
copying /usr/lib/pymodules/python2.7/numpy/f2py/src/fortranobject.h -> /tmp/tmpjxR2Ko/src.linux-i686-2.7
build_src: building npy-pkg config files
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize GnuFCompiler
Could not locate executable g77
Found executable /usr/bin/f77
gnu: no Fortran 90 compiler found
gnu: no Fortran 90 compiler found
customize IntelFCompiler
Found executable /opt/intel/bin/ifort
customize IntelFCompiler
customize IntelFCompiler using build_ext
building 'fibl' extension
compiling C sources
C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC

creating /tmp/tmpjxR2Ko/tmp
creating /tmp/tmpjxR2Ko/tmp/tmpjxR2Ko
creating /tmp/tmpjxR2Ko/tmp/tmpjxR2Ko/src.linux-i686-2.7
compile options: '-I/tmp/tmpjxR2Ko/src.linux-i686-2.7 -I/usr/lib/pymodules/python2./numpy/core/include -I/usr/include/ python2.7 -c'
gcc: /tmp/tmpjxR2Ko/src.linux-i686-2.7/fiblmodule.c
/tmp/tmpjxR2Ko/src.linux-i686-2.7/fiblmodule.c:16:20: fatal error: Python.h: No    such file or directory
compilation terminated.
/tmp/tmpjxR2Ko/src.linux-i686-2.7/fiblmodule.c:16:20: fatal error: Python.h: No such file or directory
compilation terminated.

您缺少Python开发文件(例如Python.h头文件)。从您的输出来看,您似乎在Linux上。如果是这样,那么您只需要安装
pythondev
包(至少在Debian和Ubuntu上是这样称呼的)或
pythondevel


对于Python 3,您可能需要
python3-dev
python3-devel
,具体取决于您的Linux发行版。

您缺少Python开发文件(例如Python.h头)。从您的输出来看,您似乎在Linux上。如果是这样,那么您只需要安装
pythondev
包(至少在Debian和Ubuntu上是这样称呼的)或
pythondevel


对于python3,您可能需要
python3 dev
python3 devel
,具体取决于您的Linux发行版。

它说找不到
Python.h
,您是否正确安装了Python包含文件?(请说明您的操作系统版本和安装python的方式)并向我们展示您对f2py的命令行调用吗?它说它找不到
python.h
,您是否正确安装了python包含文件?(请说明您的操作系统版本和安装python的方式),您还可以向我们展示您对f2py的命令行调用吗?