gpt4 book ai didi

python - CTRL-C 导致 forrtl : error (200) rather than python KeyboardInterrupt exception

转载 作者:太空宇宙 更新时间:2023-11-03 11:21:14 25 4
gpt4 key购买 nike

我正在尝试做与这个问题完全相同的事情:

How to prevent a block of code from being interrupted by KeyboardInterrupt in Python?(抱歉,还没有足够的代表将此作为评论发布到那里)

但是,那里发布的两个最重要的答案都不适合我。当我使用这些解决方案中的任何一个按 CTRL+C 时,脚本仍会立即关闭:

forrtl: error (200): program aborting due to control-C event

我正在处理的代码相当长,并且包含相当多的导入模块。我假设这些模块之一正在干扰 KeyboardInterrupt 的正常行为是否正确?如果是这样,我如何确定是哪一个?

(我在 Windows 上运行 python 2.7.6,32 位)

谢谢。

最佳答案

Scipy 导致了这个问题。下面的链接提供了一个解决方案,请注意,这不是 scipy.stats 独有的,其他 scipy 函数也会出现。

Ctrl-C crashes Python after importing scipy.stats

关于python - CTRL-C 导致 forrtl : error (200) rather than python KeyboardInterrupt exception,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42653389/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com