Python 进程以退出代码 139 结束(被信号 11 中断:SIGSEGV)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/49414841/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
提问by Andre
I'm trying to execute a Python script, but I am getting the following error:
我正在尝试执行Python 脚本,但出现以下错误:
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
I'm using python 3.5.2 on a Linux Mint 18.1 Serena OS
我在 Linux Mint 18.1 Serena OS 上使用 python 3.5.2
Can someone tell me why this happens, and how can I solve?
有人可以告诉我为什么会发生这种情况,我该如何解决?
采纳答案by Jean-Paul Calderone
The SIGSEGV signal indicates a "segmentation violation" or a "segfault". More or less, this equates to a read or write of a memory address that's not mapped in the process.
SIGSEGV 信号指示“分段违规”或“分段错误”。或多或少,这等同于读取或写入未在进程中映射的内存地址。
This indicates a bug in your program. In a Python program, this is either a bug in the interpreter or in an extension module being used (and the latter is the most common cause).
这表明您的程序中存在错误。在 Python 程序中,这要么是解释器中的错误,要么是正在使用的扩展模块中的错误(后者是最常见的原因)。
To fix the problem, you have several options. One option is to produce a minimal, self-contained, complete example which replicates the problem and then submit it as a bug report to the maintainers of the extension module it uses.
要解决此问题,您有多种选择。一种选择是生成一个最小的、自包含的、完整的示例来复制问题,然后将其作为错误报告提交给它使用的扩展模块的维护者。
Another option is to try to track down the cause yourself. gdbis a valuable tool in such an endeavor, as is a debug build of Python and all of the extension modules in use.
另一种选择是尝试自己找出原因。 在这样的努力中,gdb是一个有价值的工具,就像 Python 和所有正在使用的扩展模块的调试版本一样。
After you have gdb installed, you can use it to run your Python program:
安装 gdb 后,您可以使用它来运行您的 Python 程序:
gdb --args python <more args if you want>
And then use gdb commands to track down the problem. If you use run
then your program will run until it would have crashed and you will have a chance to inspect the state using other gdb commands.
然后使用 gdb 命令来追踪问题。如果您使用,run
那么您的程序将一直运行直到它崩溃为止,您将有机会使用其他 gdb 命令检查状态。
回答by Josh Friedlander
Another possible cause (which I encountered today) is that you're trying to read/write a file which is open. In this case, simply closing the file and rerunning the script solved the issue.
另一个可能的原因(我今天遇到的)是您试图读/写一个打开的文件。在这种情况下,只需关闭文件并重新运行脚本即可解决问题。
回答by Andre
After some times I discovered that I was running a new TensorFlow version that gives error on older computers. I solved the problem downgrading the TensorFlow version to 1.4
一段时间后,我发现我正在运行一个新的 TensorFlow 版本,该版本在旧计算机上出现错误。我解决了将 TensorFlow 版本降级到 1.4 的问题
回答by madogan
When I encounter this problem, I realize there are some memory issues. I rebooted PC and solved it.
当我遇到这个问题时,我意识到存在一些内存问题。我重新启动了PC并解决了它。
回答by gies0r
This can also be the case if your C-program (e.g. using cpython
is trying to access a variable out-of-bound
如果您的 C 程序(例如 usingcpython
试图访问一个越界的变量,情况也可能如此)
ctypedef struct ReturnRows:
double[10] your_value
cdef ReturnRows s_ReturnRows # Allocate memory for the struct
s_ReturnRows.your_value = [0] * 12
will fail with
会失败
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
回答by Ashish
found on other page. interpreter: python 3.8
在其他页面上找到。解释器:python 3.8
cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml")
cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml")
this solved issue for me. i was getting SIGSEGV with 2.7, upgraded my python to 3.8 then got different error with OpenCV. and found answer on OpenCV 4.0.0 SystemError: <class 'cv2.CascadeClassifier'> returned a result with an error set.
这为我解决了问题。我正在使用 2.7 获取 SIGSEGV,将我的 python 升级到 3.8,然后使用 OpenCV 出现不同的错误。并在OpenCV 4.0.0 SystemError: <class 'cv2.CascadeClassifier'> returns a result with an error set上找到答案。
but eventually one line of code fixed it.
但最终一行代码修复了它。