opencv-python imshow()时报错

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hanshuobest/article/details/86533402

ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
objc[25692]: Class QCocoaColorPanelDelegate is implemented in both /usr/local/lib/python2.7/site-packages/cv2/.dylibs/QtGui (0x104bd0d60) and /usr/local/Cellar/qt@4/4.8.7_5/lib/QtGui.framework/Versions/4/QtGui (0x10ec95130). One of the two will be used. Which one is undefined.
objc[25692]: Class QMacSoundDelegate is implemented in both /usr/local/lib/python2.7/site-packages/cv2/.dylibs/QtGui (0x104bd0db0) and /usr/local/Cellar/qt@4/4.8.7_5/lib/QtGui.framework/Versions/4/QtGui (0x10ec95180). One of the two will be used. Which one is undefined.
objc[25692]: Class QCocoaPanel is implemented in both /usr/local/lib/python2.7/site-packages/cv2/.dylibs/QtGui (0x104bd0e00) and /usr/local/Cellar/qt@4/4.8.7_5/lib/QtGui.framework/Versions/4/QtGui (0x10ec951d0). One of the two will be used. Which one is undefined.
objc[25692]: Class QCocoaView is implemented in both /usr/local/lib/python2.7/site-packages/cv2/.dylibs/QtGui (0x104bd0e50) and /usr/local/Cellar/qt@4/4.8.7_5/lib/QtGui.framework/Versions/4/QtGui (0x10ec95220). One of the two will be used. Which one is undefined.
objc[25692]: Class QCocoaWindow is implemented in both /usr/local/lib/python2.7/site-packages/cv2/.dylibs/QtGui (0x104bd0ea0) and /usr/local/Cellar/qt@4/4.8.7_5/lib/QtGui.framework/Versions/4/QtGui (0x10ec95270). One of the two will be used. Which one is undefined.
objc[25692]: Class QCocoaWindowDelegate is implemented in both /usr/local/lib/python2.7/site-packages/cv2/.dylibs/QtGui (0x104bd0ef0) and /usr/local/Cellar/qt@4/4.8.7_5/lib/QtGui.framework/Versions/4/QtGui (0x10ec952c0). One of the two will be used. Which one is undefined.
objc[25692]: Class QCocoaMenuLoader is implemented in both /usr/local/lib/python2.7/site-packages/cv2/.dylibs/QtGui (0x104bd0f40) and /usr/local/Cellar/qt@4/4.8.7_5/lib/QtGui.framework/Versions/4/QtGui (0x10ec95310). One of the two will be used. Which one is undefined.
objc[25692]: Class QNSApplication is implemented in both /usr/local/lib/python2.7/site-packages/cv2/.dylibs/QtGui (0x104bd0f90) and /usr/local/Cellar/qt@4/4.8.7_5/lib/QtGui.framework/Versions/4/QtGui (0x10ec95360). One of the two will be used. Which one is undefined.
objc[25692]: Class QCocoaApplicationDelegate is implemented in both /usr/local/lib/python2.7/site-packages/cv2/.dylibs/QtGui (0x104bd0fe0) and /usr/local/Cellar/qt@4/4.8.7_5/lib/QtGui.framework/Versions/4/QtGui (0x10ec953b0). One of the two will be used. Which one is undefined.
objc[25692]: Class QCocoaWindowCustomThemeFrame is implemented in both /usr/local/lib/python2.7/site-packages/cv2/.dylibs/QtGui (0x104bd1030) and /usr/local/Cellar/qt@4/4.8.7_5/lib/QtGui.framework/Versions/4/QtGui (0x10ec95400). One of the two will be used. Which one is undefined.
鼓捣电脑不知道装了什么东西,利用opencv无法正常显示图片,差一点就打算重做系统了,最后抱着试一试的态度没想到解决了。
根据提示,大致是和Qt相关的,网上有说是装了两个qt版本导致出现冲突,于是就是用brew list 查了一下

localhost:PycharmProjects han$ brew list
adwaita-icon-theme		libpeas
aspell				libpng
atk				librsvg
autoconf			libtiff
automake			libtool
automoc4			libunistring
boost				libvorbis
cairo				libvpx
cmake				libxml2
doxygen				mpfr
eigen				mysql
enchant				mysql-connector-c
erlang				numpy
ffmpeg				open-scene-graph
fontconfig			openblas
freetype			openexr
fribidi				openssl
gcc				opus
gd				pango
gdbm				pcre
gdk-pixbuf			pixman
gedit				pkg-config
gettext				py2cairo
glib				pygobject
gmp				pygtk
gobject-introspection		pyqt
graphite2			pyqt@4
graphviz			python
gsettings-desktop-schemas	python3
gspell				python@2
gtk+				qt
gtk+3				qt-webkit@2.3
gtk-mac-integration		qt@4
gtkglext			rabbitmq
gtksourceview3			readline
harfbuzz			rename
hicolor-icon-theme		sdl
hiredis				sdl2
icu4c				sip
ilmbase				snappy
inetutils			sqlite
isl				tbb
iso-codes			telnet
jpeg				theora
lame				tmux
libcroco			vala
libepoxy			webp
libevent			wget
libffi				wxmac
libidn				x264
libidn2				x265
libmpc				xvid
libogg				xz

果真是装了两个Qt,于是卸载其中一个

localhost:PycharmProjects han$ brew uninstall qt@4

这样执行会有个报错

Error: Refusing to uninstall /usr/local/Cellar/qt@4/4.8.7_5
because it is required by automoc4, pyqt@4 and qt-webkit@2.3, which are currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies qt@4
localhost:PycharmProjects han$ brew uninstal --ignore-dependences qt@4
Usage: brew uninstall, rm, remove [options] formula

不要气馁,根据提示执行就Ok了。

展开阅读全文

没有更多推荐了,返回首页