2016-12-21 1 views
1

Ich habe versucht, die Minimum working example Datei auf aufgelistet auszuführen:
https://docs.scipy.org/doc/numpy-dev/f2py/getting-started.htmlFehler beim Versuch, f2py (Minimum Arbeitsbeispiel) zu wickeln mit

Nach Ausführen des folgenden Befehls in Cygwin

python c:/Python27/Scripts/f2py.py -c fib1.f -m fib1 --compiler=mingw32 

Der Befehl Ausfahrten mit dem folgenden Fehler:

error: Command "gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -Ic:\cygwin\tmp\tmprggtye\src.win32-2.7 -IC:\Python27\lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC -c c:\cygwin\tmp\tmprggtye\src.win32-2.7\fib1module.c -o c:\cygwin\tmp\tmprggtye\Release\cygwin\tmp\tmprggtye\src.win32-2.7\fib1module.o" failed with exit status 1 

Unten ist die gesamte Ausgabe auf der Konsole gedruckt:

$ python c:/Python27/Scripts/f2py.py -c fib1.f -m fib1 --compiler=mingw32 
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 "fib1" sources 
f2py options: [] 
f2py:> c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c 
creating c:\cygwin\tmp\tmpucrmay\src.win32-2.7 
Reading fortran codes... 
     Reading file 'fib1.f' (format:fix,strict) 
Post-processing... 
     Block: fib1 
         Block: fib 
Post-processing (stage 2)... 
Building modules... 
     Building module "fib1"... 
       Constructing wrapper function "fib"... 
        fib(a,[n]) 
     Wrote C/API module "fib1" to file "c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c" 
    adding 'c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fortranobject.c' to sources. 
    adding 'c:\cygwin\tmp\tmpucrmay\src.win32-2.7' to include_dirs. 
copying C:\Python27\lib\site-packages\numpy\f2py\src\fortranobject.c -> c:\cygwin\tmp\tmpucrmay\src.win32-2.7 
copying C:\Python27\lib\site-packages\numpy\f2py\src\fortranobject.h -> c:\cygwin\tmp\tmpucrmay\src.win32-2.7 
build_src: building npy-pkg config files 
running build_ext 
Cannot build msvcr library: "msvcr90d.dll" not found 
customize Mingw32CCompiler 
customize Mingw32CCompiler using build_ext 
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 
Found executable C:\cygwin\bin\DF.exe 
Found executable C:\cygwin\bin\DF.exe 
customize IntelItaniumVisualFCompiler 
Could not locate executable efl 
customize Gnu95FCompiler 
Found executable C:\cygwin\bin\gfortran.exe 
Found executable C:\cygwin\bin\gfortran.exe 
customize Gnu95FCompiler 
customize Gnu95FCompiler using build_ext 
building 'fib1' extension 
compiling C sources 
C compiler: gcc -O2 -Wall -Wstrict-prototypes 

creating c:\cygwin\tmp\tmpucrmay\Release 
creating c:\cygwin\tmp\tmpucrmay\Release\cygwin 
creating c:\cygwin\tmp\tmpucrmay\Release\cygwin\tmp 
creating c:\cygwin\tmp\tmpucrmay\Release\cygwin\tmp\tmpucrmay 
creating c:\cygwin\tmp\tmpucrmay\Release\cygwin\tmp\tmpucrmay\src.win32-2.7 
compile options: '-DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -Ic:\cygwin\tmp\tmpucrmay\src.win32-2.7 -IC:\Python27\lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC -c' 
gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -Ic:\cygwin\tmp\tmpucrmay\src.win32-2.7 -IC:\Python27\lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC -c c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c -o c:\cygwin\tmp\tmpucrmay\Release\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.o 
Found executable C:\cygwin\bin\gcc.exe 
In file included from C:\Python27\include/Python.h:86:0, 
       from c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c:17: 
C:\Python27\include/intobject.h:46:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyInt_AsUnsignedLongLongMask’ 
PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); 
           ^
In file included from C:\Python27\include/Python.h:88:0, 
       from c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c:17: 
C:\Python27\include/longobject.h:50:1: warning: parameter names (without types) in function declaration 
PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG); 
^ 
In file included from C:\Python27\include/Python.h:58:0, 
       from c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c:17: 
C:\Python27\include/pyconfig.h:314:23: error: unknown type name ‘__int64’ 
# define PY_LONG_LONG __int64 
        ^
C:\Python27\include/pyport.h:793:34: note: in definition of macro ‘PyAPI_FUNC’ 
#  define PyAPI_FUNC(RTYPE) RTYPE 
           ^
C:\Python27\include/longobject.h:52:12: note: in expansion of macro ‘PY_LONG_LONG’ 
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *); 
      ^
In file included from C:\Python27\include/Python.h:88:0, 
       from c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c:17: 
C:\Python27\include/longobject.h:53:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyLong_AsUnsignedLongLong’ 
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); 
           ^
C:\Python27\include/longobject.h:54:35: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyLong_AsUnsignedLongLongMask’ 
PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); 
           ^
In file included from C:\Python27\include/Python.h:58:0, 
       from c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c:17: 
C:\Python27\include/pyconfig.h:314:23: error: unknown type name ‘__int64’ 
# define PY_LONG_LONG __int64 
        ^
C:\Python27\include/pyport.h:793:34: note: in definition of macro ‘PyAPI_FUNC’ 
#  define PyAPI_FUNC(RTYPE) RTYPE 
           ^
C:\Python27\include/longobject.h:55:12: note: in expansion of macro ‘PY_LONG_LONG’ 
PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *); 
      ^
In file included from C:\Python27\include/Python.h:8:0, 
       from c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c:17: 
C:\Python27\include/pyconfig.h:314:23: error: unknown type name ‘__int64’ 
# define PY_LONG_LONG __int64 
        ^
C:\Python27\lib\site-packages\numpy\core\include/numpy/npy_common.h:263:9: note: in expansion of macro ‘PY_LONG_LONG’ 
typedef PY_LONG_LONG npy_longlong; 
     ^
In file included from C:\Python27\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:4:0, 
       from C:\Python27\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18, 
       from C:\Python27\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4, 
       from /tmp/tmpucrmay/src.win32-2.7/fortranobject.h:13, 
       from c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c:19: 
C:\Python27\lib\site-packages\numpy\core\include/numpy/npy_common.h:264:31: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘npy_ulonglong’ 
typedef unsigned PY_LONG_LONG npy_ulonglong; 
          ^
In file included from C:\Python27\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:4:0, 
       from C:\Python27\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18, 
       from C:\Python27\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4, 
       from /tmp/tmpucrmay/src.win32-2.7/fortranobject.h:13, 
       from c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c:19: 
C:\Python27\lib\site-packages\numpy\core\include/numpy/npy_common.h:566:17: error: unknown type name ‘npy_ulonglong’ 
     typedef npy_ulonglong npy_uint64; 
       ^
In file included from C:\Python27\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:1781:0, 
       from C:\Python27\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:18, 
       from C:\Python27\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4, 
       from /tmp/tmpucrmay/src.win32-2.7/fortranobject.h:13, 
       from c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c:19: 
C:\Python27\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp] 
#warning "Using deprecated NumPy API, disable it by " \ 
^
c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c: In function ‘initfib1’: 
c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c:331:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] 
    Py_TYPE(&PyFortran_Type) = &PyType_Type; 
^
c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c: At top level: 
c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c:112:12: warning: ‘f2py_size’ defined but not used [-Wunused-function] 
static int f2py_size(PyArrayObject* var, ...) 
      ^
error: Command "gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -Ic:\cygwin\tmp\tmpucrmay\src.win32-2.7 -IC:\Python27\lib\site-packages\numpy\core\include -IC:\Python27\include -IC:\Python27\PC -c c:\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.c -o c:\cygwin\tmp\tmpucrmay\Release\cygwin\tmp\tmpucrmay\src.win32-2.7\fib1module.o" failed with exit status 1 

Ich habe über viele Links gegossen, die versuchen, irgendeine Lösung ohne Erfolg zu finden.
Ich wäre dankbar, wenn mir jemand mit dem Problem helfen könnte.
Ich benutze Windows 7 (64 Bit) und Python 2.7.11.

+0

Es heißt, dass "msvcr90d.dll" nicht gefunden wurde. Hast du versucht es zu installieren? – Nurjan

+0

msvcr90d.dll ist die Debug-Version der Laufzeit von Microsoft. Frage mich, warum f2py das anstelle der Release-Version verwenden würde (die vielleicht schon installiert ist)? –

+0

Funktioniert es, wenn Sie rein cygwin verwenden, anstatt mingw zu mischen? Zumindest müssen Sie sicherstellen, dass beide Entwicklungsketten 32 (oder 64) Bit mehr sind. – tim18

Antwort

0

Posting, was ich für die Nachwelt willen tat
direkt nach dem, was in den Kommentaren erwähnt auszuprobieren und einige mehr (können sie alle nicht erinnern), versuchte ich folgendes:

python c:/Python27/Scripts/f2py.py -c fib1.f -m fib1 --compiler=msvc --fcompiler==g77 

g77 ein Fortran-Compiler von der Stange sein (jeder andere Fortran-Compiler sollte funktionieren).

ich mit den folgenden Fehler endete:

$ python c:/Python27/Scripts/f2py.py -c fib1.f -m fib1 --compiler=msvc --fcompiler=g77 
running build 
running config_cc 
unifing config_cc, config, build_clib, build_ext, build commands --compiler options 
    commands have different --compiler options: ['mingw32', 'msvc'], using first in list as default 
running config_fc 
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options 
running build_src 
build_src 
building extension "fib1" sources 
f2py options: [] 
f2py:> c:\cygwin\tmp\tmpn3krmz\src.win32-2.7\fib1module.c 
creating c:\cygwin\tmp\tmpn3krmz\src.win32-2.7 
Reading fortran codes... 
     Reading file 'fib1.f' (format:fix,strict) 
Post-processing... 
     Block: fib1 
         Block: fib 
Post-processing (stage 2)... 
Building modules... 
     Building module "fib1"... 
       Constructing wrapper function "fib"... 
        fib(a,[n]) 
     Wrote C/API module "fib1" to file "c:\cygwin\tmp\tmpn3krmz\src.win32-2.7\fib1module.c" 
    adding 'c:\cygwin\tmp\tmpn3krmz\src.win32-2.7\fortranobject.c' to sources. 
    adding 'c:\cygwin\tmp\tmpn3krmz\src.win32-2.7' to include_dirs. 
copying C:\Python27\lib\site-packages\numpy\f2py\src\fortranobject.c -> c:\cygwin\tmp\tmpn3krmz\src.win32-2.7 
copying C:\Python27\lib\site-packages\numpy\f2py\src\fortranobject.h -> c:\cygwin\tmp\tmpn3krmz\src.win32-2.7 
build_src: building npy-pkg config files 
running build_ext 
customize MSVCCompiler 
customize MSVCCompiler using build_ext 
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 
Found executable C:\cygwin\bin\DF.exe 
Found executable C:\cygwin\bin\DF.exe 
customize IntelItaniumVisualFCompiler 
Could not locate executable efl 
customize Gnu95FCompiler 
Found executable C:\cygwin\bin\gfortran.exe 
Found executable C:\cygwin\bin\gfortran.exe 
customize Gnu95FCompiler 
customize Gnu95FCompiler using build_ext 
building 'fib1' extension 
compiling C sources 
error: Unable to find vcvarsall.bat 

Um der endgültigen Fehler loszuwerden, nahm ich Inspiration von
1) error: Unable to find vcvarsall.bat
2) How do I point easy_install to vcvarsall.bat?

ich den Standort fest einprogrammiert von vcvarsall.bat in C:/Python27/Lib/distutils/msvc9compiler unter Funktion in die Variablen toolsdir und productdir in Zeile 245 und 249.

Ich tat dies seit dem Einstellen der Umgebungsvariablen wie in 2 (oben) erwähnt nicht funktioniert.

Vielleicht keine elegante Lösung, aber es hat funktioniert.

Verwandte Themen