You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
qt.qpa.plugin: Could not load the Qt platform plugin "cocoa" in "" 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: cocoa, minimal, offscreen.
您可能要将两组Qt二进制文件加载到同一个进程中。检查所有的插件都是根据正确的Qt二进制编译的。导出DYLD_PRINT_LIBRARIES=1,并检查是否只加载了一组二进制文件。
qt.qpa。在“”中无法加载Qt平台的插件“cocoa”,即使它被找到了。
此应用程序启动失败,因为没有Qt平台插件可以初始化。重新安装应用程序可以修复这个问题。
可用的平台插件有:cocoa, minimum, offscreen。
怎么解决?求助大神,急!!!
代码上看没啥问题
刚来CSDN没多久,声望还不高,请不要见怪。
不要用PyCharm,用Python的IDLE或者在命令行里使用, python xxx.py就行了
你可以参考这个代码
import cv2 #导入模块
camera=cv2VideoCapture(0) #摄像
file=camera.read() #摄像
pic=cv2.cvtColor(file[1], cv2.COLOR--BGR2GRAY)#注意是file[1],不是直接file,COLOR和BGR2GRAY之间的--换成下划线,Markdown编辑器会出错,这段是生成黑白图片
cv2.imwrite('picture.png', pic) #保存
camera.release() #释放镜头
import tkinter as tk #导入模块,读取显示无法直接进行,可以使用tkinter
root=tk.Tk() #生成窗口
img=tk.PhotoImage(file='picture.png')
tk.Label(root, image=img).pack(side='top', fill='x') #显示图片
root.mainloop()
如果你是人脸识别的话,先读取文件,然后再按相应方法识别就好了
你现在还是再摄像的水平,不行啊,要加油努力了
欢迎关注我,以后我会发布一些关于Python的文章。