图像标注工具labelImg

Mac os & python2.7.13

1.通过Homebrew安装pyqt
执行如下代码:

brew install cartr/qt4/pyqt

安装之后可以进python中查看是否可用:

import PyQt4

若不报错,说明OK,若报错,需要进行修改,报错内容如下:

提示没有module,可是我们明明已经用brew装好了。。。

这可能是环境变量问题,需要配置环境变量,如下:

$ which python
/usr/bin/python
$ which brew
/usr/local/bin/brew

PyQt4是通过brew安装的,明显这两个路径不一致,导致问题,解决如下:

$ cd /usr/local/lib/python2.7/site-packages
$ ls
PyQt4 homebrew-protobuf.pth sip.so
cv.py numpy sipconfig.py
cv2.so numpy-1.12.1-py2.7.egg-info sipdistutils.py
homebrew-numpy-nose.pth sip.pyi
$ open ~/.bash_profile

将下面的代码加入~/.bash_profile中:

export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH

然后关闭terminal,重新开启,进入python中import:

这样,PyQt4就装好了。

2.安装labelImg
这块可以参考labelImg的Gthub上面的安装过程,代码如下:

brew install qt qt4
brew install libxml2
make all
./labelImg.py
./labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]
sudo pip install labelImg

Leave a Comment

Your email address will not be published.