簡體   English   中英

cygdb ImportError:沒有名為'Cython'的模塊

[英]cygdb ImportError: No module named 'Cython'

我想調試我的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".

正如@MarkPlotnick所指出的那樣,問題是“Ubuntu的最新版本有一個使用Python3的gdb”。

要測試本地gdb使用的Python版本:

$ gdb
(gdb) python import sys; print(sys.version)

我常說3.4.x,這就是問題所在。

為了解決這個問題,我用./configure --with-python=python2重新編譯了我的gdb。 有關詳細信息,請參閱此處

我不確定這是否是最好的解決方案,因為我是Cython和cygdb的新手。 如果有,請指出。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM