先检测是不是自己版本过高
我在anaconda里面专门弄了个虚拟环境,是python3.9的,所以环境没问题(注意cmd里面看到的python版本跟anaconda里面可能会不一样)
查看python版本:
python --version
如果还是会出现闪退,那就去D:\anaconda\Lib\site-packages\canvas.py里面将526、530、531
的代码分别改成
p.drawRect(int(left_top.x()), int(left_top.y()), int(rect_width), int(rect_height))
p.drawLine(int(self.prev_point.x()), 0, int(self.prev_point.x()), int(self.pixmap.height()))
p.drawLine( 0, int(self.prev_point.y()), int(self.pixmap.width()), int(self.prev_point.y()))
D:\anaconda\Lib\site-packages\labelImg找到labelImg.py将965行的代码改成
bar.setValue(int(bar.value() + bar.singleStep() * units))
其实就是加了个int类型的转化而已。
然后就解决啦!