2016-08-18 3 views
2

Ich habe Probleme mit dem eingebetteten Python-Interpreter in gdborig.exe des MinGW-w64-Projekts (https://sourceforge.net/p/mingw-w64/discussion/723798/thread/4a8a9ed5/?limit=25).Eingebetteter Python-Interpreter kann keine C-Module importieren

Der Import des Moduls itertools und einige andere schlägt fehl. Aber mit den dezentralen eigenständigen Python-Interpreter arbeiten die entsprechenden Importe fein:

>>> import sys 
>>> print sys.version 
2.7.9 (default, Jul 11 2016, 16:32:13) 
[GCC 6.1.0] 
>>> print sys.executable 
C:/AUEMARK/Programme/MinGW64/mingw64/opt/bin/python.exe 
>>> import itertools 
>>> itertools 
<module 'itertools' from 'C:\AUEMARK\Programme\MinGW64\mingw64\opt\libpython2.7\lib-dynload/itertools.pyd'> 

Mit dem eingebetteten Python-Interpreter:

(gdb) python import sys 
(gdb) python print sys.version 
2.7.9 (default, Jul 11 2016, 16:32:13) 
[GCC 6.1.0] 
(gdb) python print sys.executable 
C:/AUEMARK/Programme/MinGW64/mingw64/opt/bin/python.exe 
(gdb) python import itertools 
Traceback (most recent call last): 
    File "<string>", line 1, in <module> 
ImportError: No module named itertools 
Error while executing Python code. 

Can:

  • import sys
  • import os

Kann nicht:

  • Import itertools
  • Import Sammlungen
  • ...

Fehlermeldung für den Import von Sammlungen

(gdb) python import collections 
Traceback (most recent call last): 
    File "<string>", line 1, in <module> 
    File "C:\AUEMARK\Programme\MinW64\mingw64\opt\lib\python2.7/collections.py", line 8, in <module> 
    from _collections import deque, defaultdict 
Importerror: no module named _collections 
Error while executing Python code. 

So ist es wie dem eingebetteten Interpreter scheint kann Module in C. nicht importieren. Python-Module werden importiert, und die Python-Teile von C-Modulen können auch sein Zugriff durch den eingebetteten Interpreter.

Danke für jeden Hinweis, wie ich dieses Problem lösen kann.

Markus

Antwort

0

Ich denke, das Problem existiert, weil Datei itertools.pyd nicht gefunden wurde. hatte ich Umgebungsvariablen setzen:

PYTHONPATH=C:\msys64\mingw64\lib\python2.7;C:\msys64\mingw64\lib\python2.7\lib-dynload; 

In Ihrem Fall sollten Sie festlegen:

PYTHONPATH=C:/AUEMARK/Programme/MinGW64/mingw64/opt/lib/python2.7;C:\AUEMARK\Programme\MinW64\mingw64\lib\python2.7\lib-dynload 

Mein PYTHON Variable auf Python-Interpreter:

PYTHONHOME=C:\msys64\mingw64\bin\pyhon.exe 

ich meine eigene gdb gebaut unter msys2 und es funktioniert:

Microsoft Windows [Version 10.0.16299.19] 
(c) 2017 Microsoft Corporation. All rights reserved. 

C:\Users\tiit>C:\msys64\home\tiit\gdb-7.11-bin\bin\x86_64-linux-gnu-gdb.exe 
GNU gdb (GDB) 7.11.1.20160801-git 
Copyright (C) 2016 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html> 
This is free software: you are free to change and redistribute it. 
There is NO WARRANTY, to the extent permitted by law. Type "show copying" 
and "show warranty" for details. 
This GDB was configured as "--host=x86_64-w64-mingw32 --target=x86_64-linux-gnu". 
Type "show configuration" for configuration details. 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>. 
Find the GDB manual and other documentation resources online at: 
<http://www.gnu.org/software/gdb/documentation/>. 
For help, type "help". 
Type "apropos word" to search for commands related to "word". 
(gdb) 

Ohne die richtigen Umgebungsvariablen einzustellen hatte ich die gleichen Probleme.

Verwandte Themen