Kein Modul mit dem Namen 'cx_Freeze.util' ---cxFreeze in Python ist3.4
Ich versuche, cxFreeze4.3.3(Download von sourceforge) in Ubuntu 32bit, wo beide python2-und Python ist3.4 sind installiert.
Anfangs lief ich
python3.4 cxfreeze --help
Und es drucken zu helfen, wie gewünscht.
Dann lief ich
python3.4 cxfreeze /home/lz/dev/test/interface.py
wird eine Ausnahme ausgelöst:
cx_Freeze.freezer.ConfigError: no base named Console
schließlich habe ich angegeben das base-name:
python3.4 cxfreeze --base-name=/home/lz/dev/test/interface.py /home/lz/dev/test/interface.py
File "cxfreeze", line 5, in <module>
main()
File "/home/lz/cx_Freeze-4.3.3/cx_Freeze/main.py", line 188, in main
freezer.Freeze()
File "/home/lz/cx_Freeze-4.3.3/cx_Freeze/freezer.py", line 599, in Freeze
import cx_Freeze.util
ImportError: No module named 'cx_Freeze.util'
Danach habe ich kopiert util.so aus dem debian-Paket.
ImportError: /home/lz/cx_Freeze-4.3.3/cx_Freeze/util.so: undefined symbol: Py_InitModule4
Update: ich habe versucht zu kompilieren util.also von util.c,wird ein Fehler ausgelöst:
Kann nicht finden, "Python".h"
Ich durch #include mit #include "Python ist3.4/Python.h" oder #include "python2.7/Python.h", aber mehr Fehler ausgelöst:
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 2 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 3 has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 4 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 5 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 6 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 7 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 8 has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 9 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 10 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 11 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 12 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 13 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 14 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 15 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 16 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 17 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 18 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 19 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 20 has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_info): relocation 21 has invalid symbol index 22
/usr/bin/ld: /usr/lib/debug/usr/lib/i386-linux-gnu/crt1.o(.debug_line): relocation 0 has invalid symbol index 2
/usr/lib/gcc/i686-linux-gnu/4.8/../../../i386-linux-gnu/crt1.o:In function‘_start’:
(.text+0x18):‘main’ undefined reference
/tmp/ccMQ0pWq.o:In function‘ExtSetOptimizeFlag’:
util.c:(.text+0xa):‘Py_OptimizeFlag’ undefined reference
util.c:(.text+0x1d):‘PyArg_ParseTuple’ undefined reference
util.c:(.text+0x2d):‘_Py_NoneStruct’ undefined reference
util.c:(.text+0x35):‘_Py_NoneStruct’ undefined reference
util.c:(.text+0x3a):‘_Py_NoneStruct’ undefined reference
/tmp/ccMQ0pWq.o:In function ‘Module_Initialize’:
util.c:(.text+0x56):‘PyModule_Create2’ undefined reference
Compiling failed
collect2: error: ld returned 1 exit status
Seit PyQt5 steht nur in Python ist3, ich habe mit Python ist3, und cxFreeze ist das einzige Werkzeug, das unterstützt Python ist3.
Die cxFreeze debian-Paket funktioniert gut in python2.
Ich wirklich zu schätzen jede Hilfe.
- Ändern Sie die include-wieder nur
python.h
, und stellen Sie sicher, dasspython3-dev
ist installiert (von apt). Sie werden wahrscheinlich auch brauchen, um die änderung beschrieben in dieses Problem, um es zu kompilieren. - Danke. Python ist3-dev installiert ist, während #include "Python.h" oder "python".h" immer noch nicht gefunden werden.
Du musst angemeldet sein, um einen Kommentar abzugeben.
Gut, ich habe dieses problem gelöst.Hier sind die Schritte:
if True:
sudo python3.4 setup.py install
Und dann funktioniert auch alles.
Danke für @TomasK