Win10安装lableImg及过程中的问题

安装lableImg需要anaconda,这里不详细讲anaconda安装过程,我base环境下的python是3.10,后面由于这个原因造成labelImg闪退,但也有解决方法

下载labelImg

下载地址:GitHub - HumanSignal/labelImg: LabelImg is now part of the Label Studio community. The popular image annotation tool created by Tzutalin is no longer actively being developed, but you can check out Label Studio, the open source data labeling tool for images, text, hypertext, audio, video and time-series data.

或者百度网盘:https://pan.baidu.com/s/1uQ-P3ptn4tLBwYeKHu1YQg 提取码:lntn

下载好后,win10菜单栏搜索Anaconda Prompt,打开,输入命令到下载了labelImg的路径下,

安装如下包:

pip install pyqt5

pip install lxml

执行命令

pyrcc5 -o resources.py resources.qrc

 提示“pyrcc5”不被识别为内部或外部命令、可操作的程序批处理文件

还需要安装pyqt5-tools

pip install pyqt5-tools

再次执行命令pyrcc5 -o resources.py resources.qrc,没有提示了

运行python labelImg.py 打开软件后但是会闪退,提示:TypeError: setValue(self, int): argument 1 has unexpected type ‘float‘

通过网上查找方法有如下两种解决方法:

1、labelImg需要的python版本为3.9,在Anaconda 重新建立一个新的环境重新安装

2、修改代码,这里我用的这种方法,如下:

(1)更改canvas.py,文件的路径在下载labelImg的libs文件夹中,在458行、462行、467行做出如下更改:

p.drawRect(left_top.x(), left_top.y(), rect_width), int(rect_height)改为

p.drawRect(int(left_top.x()), int(left_top.y()), int(rect_width), int(rect_height))

p.drawLine( self.prev_point.x(), 0, self.prev_point.x(), self.pixmap.height())改为

p.drawLine( int(self.prev_point.x()), 0, int(self.prev_point.x()), int(self.pixmap.height()))

p.drawLine( 0, self.prev_point.y(), self.pixmap.width(), self.prev_point.y())改为

p.drawLine( 0, int(self.prev_point.y()), int(self.pixmap.width()), int(self.prev_point.y()))

(2)更改labelImg.py文件,在883行,

bar.setValue(bar.value() + bar.singleStep() * units)改为

bar.setValue(int(bar.value() + bar.singleStep() * units))

 如上便解决了闪退问题,可以使用labelImg了

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值