我在MinGW-w64项目(https://sourceforge.net/p/mingw-w64/discussion/723798/thread/4a8a9ed5/?limit=25)的gdborig.exe中的嵌入式python解释器有问题。
模块迭代工具和其他一些工具的导入失败。但是,使用分布式独立python解释器,相应的导入可以正常工作:
>>> 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'>使用嵌入的python解释器:
(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:
不能:
用于导入集合的错误消息
(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.因此,嵌入式解释器似乎无法导入C中的模块。Python模块是导入的,C模块的Python部分也可以由嵌入式解释器访问。
谢谢你的提示,我怎么能解决这个问题。
马库斯
发布于 2017-10-31 12:37:44
我认为这个问题的存在是因为找不到文件itertools.pyd。我必须设置环境变量:
PYTHONPATH=C:\msys64\mingw64\lib\python2.7;C:\msys64\mingw64\lib\python2.7\lib-dynload;在您的情况下,请确保设置:
PYTHONPATH=C:/AUEMARK/Programme/MinGW64/mingw64/opt/lib/python2.7;C:\AUEMARK\Programme\MinW64\mingw64\lib\python2.7\lib-dynload我的PYTHONHOME变量指向python解释器:
PYTHONHOME=C:\msys64\mingw64\bin\pyhon.exe我在msys2下构建了自己的gdb,它运行如下:
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)在没有设置正确的环境变量的情况下,我遇到了同样的问题。
https://stackoverflow.com/questions/39022702
复制相似问题