导入 python 包(moviepy)时出现分段错误

segmentation fault when importing python package(moviepy)

当我在 python 代码中编写以下语句时,收到分段错误。

>>> import moviepy.editor
Segmentation fault (core dumped)

这有什么问题?

os: ubuntu 16.04
python: 3.6
电影:0.2.3.2
ffmpeg:3.3.4

更新

我现在尝试用 gdb 调试它:

$ gdb
(gdb) file python
Reading symbols from python...done.
(gdb) run test.py 

Starting program: /home/ubuntu/anaconda3/bin/python test.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
PyType_IsSubtype (a=0x626f6174656d5f74, b=0x7fffd9df0640 <sipVoidPtr_Type>) at Objects/typeobject.c:1357
1357    Objects/typeobject.c: No such file or directory.

(gdb) bt
#0  PyType_IsSubtype (a=0x626f6174656d5f74, b=0x7fffd9df0640 <sipVoidPtr_Type>) at Objects/typeobject.c:1357
#1  0x00007fffd9be7221 in vp_convertor () from /home/ubuntu/anaconda3/lib/python3.6/site-packages/sip.so
#2  0x00007fffd9be7ab5 in sip_api_convert_to_void_ptr ()
   from /home/ubuntu/anaconda3/lib/python3.6/site-packages/sip.so
#3  0x00007fffd98df29d in qpycore_init() ()
   from /home/ubuntu/anaconda3/lib/python3.6/site-packages/PyQt5/QtCore.so
#4  0x00007fffd98c8b44 in PyInit_QtCore ()
   from /home/ubuntu/anaconda3/lib/python3.6/site-packages/PyQt5/QtCore.so
#5  0x00007ffff7a3e55b in _PyImport_LoadDynamicModuleWithSpec (spec=0x7fffda0807f0,
    fp=0x7fffd98c8a60 <PyInit_QtCore>) at ./Python/importdl.c:154
#6  0x00007ffff7a3b33f in _imp_create_dynamic_impl (file=<optimized out>, spec=0x7fffda0807f0,
    module=<optimized out>) at Python/import.c:2004
#7  _imp_create_dynamic (module=<optimized out>, args=<optimized out>) at Python/clinic/import.c.h:289
#8  0x00007ffff7994ca9 in PyCFunction_Call (func=0x7ffff69c8f78, args=0x7fffda080438, kwds=<optimized out>)
    at Objects/methodobject.c:114
#9  0x00007ffff7a20b3c in do_call_core (kwdict=0x7fffda085ee8, callargs=<optimized out>, func=0x7ffff69c8f78)
    at Python/ceval.c:5053
#10 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3357
#11 0x00007ffff7a184c0 in _PyEval_EvalCodeWithName (_co=0x7ffff7e2de40, globals=<optimized out>,
    locals=<optimized out>, args=<optimized out>, argcount=2, kwnames=0x0, kwargs=0x7fffe2c05590, kwcount=0,
    kwstep=1, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x7ffff69ab8f0, qualname=0x7ffff69ab8f0)
    at Python/ceval.c:4119
#12 0x00007ffff7a19eea in fast_function (kwnames=<optimized out>, nargs=2, stack=<optimized out>,
    func=0x7ffff7e18ea0) at Python/ceval.c:4929
#13 call_function (pp_stack=0x7fffffff4588, oparg=<optimized out>, kwnames=<optimized out>)
    at Python/ceval.c:4809
#14 0x00007ffff7a1cbbd in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>)
    at Python/ceval.c:3275
---Type <return> to continue, or q <return> to quit---

test.py(只有1行):

import moviepy.editor

解决方法: gdb 调试日志中的 SIP 包似乎有问题。所以,我更新了SIP包,问题就解决了。