mini梁翊洲MAX 2022-03-05 21:30 采纳率: 20%
浏览 340
已结题

import cv2 导致 Segmentation fault (core dumped)

在运行文件的时候出现Segmentation fault (core dumped)的错误
经过排查,在即使只有一句 import cv2的文件中运行也会产生这个错误
怀疑是因为opencv的原因
我的opencv的安装是参照https://pyimagesearch.com/2018/09/19/pip-install-opencv/
查找解决方法时,有人提议使用_LD_DEBUG=files python -c "import cv2"_来查看错误
但是我看不懂以下的输出。请问有无办法解决这个问题?


```c
2623:   
      2623:    file=libc.so.6 [0];  needed by python [0]
      2623:    file=libc.so.6 [0];  generating link map
      2623:      dynamic: 0x00007f5fbf800b80  base: 0x00007f5fbf616000   size: 0x00000000001f14d8
      2623:        entry: 0x00007f5fbf63d1f0  phdr: 0x00007f5fbf616040  phnum:                 14
      2623:   
      2623:   
      2623:    file=libpthread.so.0 [0];  needed by python [0]
      2623:    file=libpthread.so.0 [0];  generating link map
      2623:      dynamic: 0x00007f5fbf610d70  base: 0x00007f5fbf5f3000   size: 0x0000000000022478
      2623:        entry: 0x00007f5fbf5fb190  phdr: 0x00007f5fbf5f3040  phnum:                 13
      2623:   
      2623:   
      2623:    file=libdl.so.2 [0];  needed by python [0]
      2623:    file=libdl.so.2 [0];  generating link map
      2623:      dynamic: 0x00007f5fbf5f1d90  base: 0x00007f5fbf5ed000   size: 0x0000000000005110
      2623:        entry: 0x00007f5fbf5ee220  phdr: 0x00007f5fbf5ed040  phnum:                 11
      2623:   
      2623:   
      2623:    file=libutil.so.1 [0];  needed by python [0]
      2623:    file=libutil.so.1 [0];  generating link map
      2623:      dynamic: 0x00007f5fbf5ebdc8  base: 0x00007f5fbf5e8000   size: 0x0000000000004110
      2623:        entry: 0x00007f5fbf5e93e0  phdr: 0x00007f5fbf5e8040  phnum:                 11
      2623:   
      2623:   
      2623:    file=libm.so.6 [0];  needed by python [0]
      2623:    file=libm.so.6 [0];  generating link map
      2623:      dynamic: 0x00007f5fbf5e6d90  base: 0x00007f5fbf499000   size: 0x000000000014e110
      2623:        entry: 0x00007f5fbf4a83c0  phdr: 0x00007f5fbf499040  phnum:                 11
      2623:   
      2623:   
      2623:    file=libexpat.so.1 [0];  needed by python [0]
      2623:    file=libexpat.so.1 [0];  generating link map
      2623:      dynamic: 0x00007f5fbf497de0  base: 0x00007f5fbf46b000   size: 0x000000000002d0a0
      2623:        entry: 0x00007f5fbf46f230  phdr: 0x00007f5fbf46b040  phnum:                 11
      2623:   
      2623:   
      2623:    file=libz.so.1 [0];  needed by python [0]
      2623:    file=libz.so.1 [0];  generating link map
      2623:      dynamic: 0x00007f5fbf467df0  base: 0x00007f5fbf44d000   size: 0x000000000001b0b8
      2623:        entry: 0x00007f5fbf44f280  phdr: 0x00007f5fbf44d040  phnum:                 11
      2623:   
      2623:   
      2623:    calling init: /lib/x86_64-linux-gnu/libpthread.so.0
      2623:   
      2623:   
      2623:    calling init: /lib/x86_64-linux-gnu/libc.so.6
      2623:   
      2623:   
      2623:    calling init: /lib/x86_64-linux-gnu/libz.so.1
      2623:   
      2623:   
      2623:    calling init: /lib/x86_64-linux-gnu/libexpat.so.1
      2623:   
      2623:   
      2623:    calling init: /lib/x86_64-linux-gnu/libm.so.6
      2623:   
      2623:   
      2623:    calling init: /lib/x86_64-linux-gnu/libutil.so.1
      2623:   
      2623:   
      2623:    calling init: /lib/x86_64-linux-gnu/libdl.so.2
      2623:   
      2623:   
      2623:    initialize program: python
      2623:   
      2623:   
      2623:    transferring control: python
      2623:   
      2623:   
      2623:    file=/home/liangyz/.virtualenvs/cv/lib/python3.8/site-packages/cv2/cv2.abi3.so [0];  dynamically loaded by python [0]
      2623:    file=/home/liangyz/.virtualenvs/cv/lib/python3.8/site-packages/cv2/cv2.abi3.so [0];  generating link map
      2623:      dynamic: 0x00007f5fbe43d000  base: 0x00007f5fb9ad9000   size: 0x000000000496d990
      2623:        entry: 0x00007f5fb9cf5700  phdr: 0x00007f5fb9ad9040  phnum:                 21
      2623:   
Segmentation fault (core dumped)

```

  • 写回答

1条回答 默认 最新

  • mini梁翊洲MAX 2022-03-06 10:52
    关注

    问题已解决,我重装了opencv-contrib-python包,就没问题了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 3月14日
  • 已采纳回答 3月6日
  • 创建了问题 3月5日

悬赏问题

  • ¥15 python使用pulp线性优化时报错
  • ¥15 开源或低价数据中台哪个最好
  • ¥15 arduino编程出现字符串疑似覆盖现象
  • ¥15 我的b站在没有碰到屏幕的情况下偶尔会自动跳出进度条,就像在屏幕上点了一下一样,但我并没有点。而且视频进度并没有变。这可能是什么原因造成的?
  • ¥30 STK matlab python仿真
  • ¥15 关于IMageEnView 图标定位问题
  • ¥20 求解答(matlab)
  • ¥30 ffmpeg库使用过程中遇到的问题
  • ¥15 pyqt5 中python如何通过Qtwebchannel主动发消息给web前端
  • ¥15 关于HTML中title获取xml内容的问题