pydev eclipse入门-“找不到使用cython的调试器加速程序”,然后“发生了另一个异常”

时间:2018-11-07 19:23:41

标签: python-3.x eclipse cython pydev

我正在pydev网站上进行“入门”,一切都按照描述进行,直到我进入http://www.pydev.org/manual_101_run.html上有关调试的部分。但是,我现在收到警告“找不到使用cython的调试器加速”,然后在尝试处理该异常时出现错误。

我要运行的代码名为example.py:

'''
Created on Nov 7, 2018

@author: Chris
'''
if __name__ == '__main__':
    print('Hello World')

当我在不打开调试模式的情况下运行此命令时,它将在控制台上正确打印“ Hello World”。按照入门页面中的建议,我在第7行添加了一个断点,并在调试模式下(通过按F11键)重新运行了代码。这样做时,我得到以下控制台输出:

warning: Debugger speedups using cython not found. Run '"C:\Users\Chris\AppData\Local\Programs\Python\Python37\python.exe" "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\setup_cython.py" build_ext --inplace' to build.
pydev debugger: starting (pid: 7864)
Traceback (most recent call last):
  File "_pydevd_bundle\pydevd_cython_win32_37_64.pyx", line 134, in _pydevd_bundle.pydevd_cython_win32_37_64.set_additional_thread_info
AttributeError: '_MainThread' object has no attribute 'additional_info'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\pydevd.py", line 1951, in <module>
    main()
  File "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\pydevd.py", line 1945, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\pydevd.py", line 1295, in run
    self.notify_thread_created(thread_id, t)
  File "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\pydevd.py", line 662, in notify_thread_created
    additional_info = set_additional_thread_info(thread)
  File "_pydevd_bundle\pydevd_cython_win32_37_64.pyx", line 138, in _pydevd_bundle.pydevd_cython_win32_37_64.set_additional_thread_info
  File "_pydevd_bundle\pydevd_cython_win32_37_64.pyx", line 147, in _pydevd_bundle.pydevd_cython_win32_37_64.set_additional_thread_info
  File "_pydevd_bundle\pydevd_cython_win32_37_64.pyx", line 95, in _pydevd_bundle.pydevd_cython_win32_37_64.PyDBAdditionalThreadInfo.__init__
AttributeError: '_pydevd_bundle.pydevd_cython_win32_37_64.PyDBAdditionalThreadInfo' object has no attribute 'pydev_state'

相关问题Eclipse pydev warning - "Debugger speedups using cython not found."建议在警告的第一行中运行代码

"C:\Users\Chris\AppData\Local\Programs\Python\Python37\python.exe" "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\setup_cython.py" build_ext --inplace

这样做时,出现以下错误

  File "<input>", line 1
    "C:\Users\Chris\AppData\Local\Programs\Python\Python37\python.exe" "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\setup_cython.py" build_ext --inplace
                                                                                                                                                                                ^
SyntaxError: invalid syntax

如果情况不太明显,我是python,eclipse,StackOverflow和PyDev的最高新手-今天上午在每个人中都开始这样做。

1 个答案:

答案 0 :(得分:0)

首先要解决的问题是,https://stackoverflow.com/a/53210935/110451(在您的情况下,只需将PyDev升级到7.0.3即可解决此问题)。

关于无法重新生成cython加速器模块,现在应执行:

"C:\Users\Chris\AppData\Local\Programs\Python\Python37\python.exe" "C:\Users\Chris\.p2\pool\plugins\org.python.pydev.core_7.0.0.201811071319\pysrc\setup_cython.py" build_ext --inplace

在您的终端中(即:在cmd.exe中),而不是作为Python模块...