2016-11-22 2 views
2

Kann jemand genau feststellen, wo ich falsch mache, BITTE? Ich bin so erschöpft. Ich installierte MinGW 4.7, Python 2.7.8, Numpy 1.7.1 und Scipy0.13.2 zu einer Anaconda (32bit) Umgebung in Windows7.
Auch für Variablen Benutzerumgebung, habe ichkann keine Lösung für die Ausführung von f2py korrekt auf meinem Windows 7 Maschine finden

C_INCLUDE_PATH: D: \ Anaconda2 \ ENVs \ arc103 \ MinGW \ i686-w64-mingw32 \

Pfad (Benutzer variabel) umfassen: C: \ Program Files (x86) \ Microsoft VS Code \ bin; D: \ Anaconda2 \ Library \ bin; D: \ Anaconda2 \ ENVs \ arc103 \ MinGW \ bin

Binden Sie die folgenden Befehle in Anaconda Prompt

  1. "f2py -c --help-fcompiler "Ausgänge" ... Fortran Compilern gefunden: --fcompiler = gnu95 GNU Fortran 95 Compiler (4.7.0) ....“

  2. "f2py -c --help-Compiler" Ausgänge "Liste der verfügbaren Compiler: ...", nicht speziell gefundene Compiler.

Running "f2py -c fib1.f -m FIB1" nach "NumPy v1.12.dev0 Manual" gibt mir viele Fehler wie folgt:

D:\Anaconda2\envs\arc103\Scripts\gfortran.bat -Wall -Wall -shared c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-.7\fib1module.oc:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fortranobject.o c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\fib1.o -Ld:\anaconda2\envs\arc103\mingw\lib\gcc\i686-w64-mingw32\4.7.0 -LD:\Anaconda2\envs\arc103\libs -LD:\Anaconda2\envs\arc103\PCbuild -lpython27 -lgfortran -o .\fib1.pyd 

c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fib1module.o:fib1module.c:(.text+0x35): undefined reference to `__imp__PyNumber_Int' 
c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fib1module.o:fib1module.c:(.text+0x68): undefined reference to `__imp__PyComplex_Type' 
c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fib1module.o:fib1module.c:(.text+0x79): undefined reference to `__imp__PyType_IsSubtype' 
c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fib1module.o:fib1module.c:(.text+0x93): undefined reference to `__imp__PyErr_Occurred' 

... (Thousands of "undefined reference to" errors I didn't put it here) ... 

collect2.exe: error: ld returned 1 exit statuserror: Command "D:\Anaconda2\envs\arc103\Scripts\gfortran.bat -Wall -Wall -shared c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fib1module.o 
c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\users\dkim1\appdata\local\temp\tmpvyedhg\src.win32-2.7\fortranobject.o 
c:\users\dkim1\appdata\local\temp\tmpvyedhg\Release\fib1.o -Ld:\anaconda2\envs\arc103\mingw\lib\gcc\i686-w64-mingw32\4.7.0 -LD:\Anaconda2\envs\arc103\libs 
-LD:\Anaconda2\envs\arc103\PCbuild -lpython27 -lgfortran -o .\fib1.pyd" failed with exit status 1 

Sorry für die Verwirrung. Ich habe fast ein paar Monate damit verbracht, den Fix herauszufinden, aber es ist zu schwer für mich und alles vergebens. Es wäre sehr geschätzt, wenn Sie mir helfen können. Vielen Dank.

+0

Können Sie die volle Leistung abgeben.? (natürlich ohne die "undefined reference to" -Fehler) –

Antwort

0

Da dies ein paar Monate alt ist, bin ich mir nicht sicher, ob diese Tipps noch helfen werden, aber ich fand beim Erstellen eines Fortran zu Python-Moduls auf Win 10, das nur Kompilieren für 32bit funktioniert, und Sie müssen ein verwenden Signaturdatei, also etwas entlang der Linien von:

f2py.py -c cuncsd.pyf cuncsd.f 

Statt mit dem i686-w64-mingw32 Toolchain ich ein gerade mingw32 ein (um das Risiko zu verringern, dass ich versehentlich mit etwas 64bit am Ende) verwendet.

Ich fand auch, dass Sie ein spezielles Visual Studio für Python-Instanz installieren müssen, wie hier beschrieben: Microsoft Visual C++ Compiler for Python 3.4

Wenn Sie Python 2.7 diese VSC-Version verwenden, sollten den Trick für Sie tun, nur neuere Version (3.5 , 3.6) sind zu dieser Zeit ausgelassen.

Als Referenz hier ist mein kompletter f2py Aufruf auf der Konsole, die ich am Ende mit (weder Python noch f2py waren auf dem Ausführungspfad):

python C:\Python34\Scripts\f2py.py -c cuncsd.pyf --opt="-frecursive -fmax-stack-var-size=66560" cuncsd.f -llapack -lrefblas -ltmglib 

Dieses spezielle Modul auf 32-Bit-LAPCK gemeinsam genutzte Bibliotheken abhängt, Ich habe früher kompiliert, und wir haben festgestellt, dass es sogar auf XP-Systemen funktioniert.

Ich ging später zurück und versuchte, dies für 64 Bit zu kompilieren, gab aber schließlich auf, als ich immer auf ld Fehler stieß. Ich denke, für Windows 10 wird es viel einfacher sein, das eingebettete Ubuntu zu verwenden, um Python auszuführen und zu erweitern.

(Siehe How to enable Bash in Windows 10 developer preview? und Getting PyCharm to recognize python on the windows linux subsystem (bash on windows))

Verwandte Themen