cygdb ImportError:没有名为'Cython'的模块

ryu*_*fly 4 python gdb cython python-2.7

我想调试我的Cython代码,并按照这里描述的确切步骤.我的Cython代码编译($ cython --gdb xxx.pyx然后$ python setup.py build_ext --inplace)但似乎cygdb在我的系统上无法正常工作.我使用的是Ubuntu 14.04,Python 2.7.6,Cython 0.23.4.我也尝试过另一个系统(Ubuntu 15.04),但也没有运气.也没有重新安装Cython工作.

$ python -c 'import Cython' 适用于我的系统,我相信这表明Cython已正确安装.

我用Google搜索,但找不到解决方案.如果有什么我错过了,请指出.

$ cygdb .

GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 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 "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".
Traceback (most recent call last):
  File "<string>", line 11, in <module>
ImportError: No module named 'Cython'
/tmp/tmpEkb_tX:19: Error in sourced command file:
Error while executing Python code.
(gdb) cy run abc.py
Undefined command: "cy".  Try "help".
Run Code Online (Sandbox Code Playgroud)

ryu*_*fly 5

正如@MarkPlotnick所指出的那样,问题是"Ubuntu的最新版本有一个使用Python3的gdb".

要测试本地gdb使用的Python版本:

$ gdb
(gdb) python import sys; print(sys.version)
Run Code Online (Sandbox Code Playgroud)

我常说3.4.x,这就是问题所在.

要解决它,我重新编译了我的gdb ./configure --with-python=python2.有关详细信息,请参阅此处.

我不确定这是否是最好的解决方案,因为我是Cython和cygdb的新手.如果有,请指出.