2022年7月7日木曜日

matplotlib.pyplotとpyQt5とopencvに関するエラー

import os, cv2, itertools, csv
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

このような環境中、pltを使ったところで(ubuntu 22.04)

QObject::moveToThread: Current thread (0x561c4d10a240) is not the object's thread (0x561c4d65a110).
Cannot move to target thread (0x561c4d10a240)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/deeptitan/.local/lib/python3.10/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc.
Aborted (core dumped)

このような珍しいエラー。
どうやらmatplotlib.pyplotが使っているqtとopencvがぶつかっているみたいです。

対応方法は、
$ pip uninstall opencv-python
$ pip install opencv-python-headless
です。

ぶつかっているopencvのheadを無くせばいいわけです。


0 件のコメント:

コメントを投稿

パワーポイントからGIFアニメーションなどの動画を取り出す方法

 xxx.pptx を xxx.pptx.zip と名前をかえる。 あとはダブルクリックでpptxファイルの中身が見える。 目的の動画ファイルはmediaフォルダー内にある。 めっちゃ便利。