一分钟搞定 Mac 安装labelImg

我的电脑 环境是 Python 2.7.13 |Anaconda custom (x86_64) 也就是 装了 Anaconda包,之前自带pyqt5 (5.6.2)

强烈推荐 pip 安装 labelImg

pip install labelImg

然后输入以下命令

labelImg

运行一下,发现报错了

Traceback (most recent call last):
  File "/Applications/anaconda/bin/labelImg", line 7, in 
    from labelImg.labelImg import main
  File "/Applications/anaconda/lib/python2.7/site-packages/labelImg/labelImg.py", line 27, in 
    import resources
  File "/Applications/anaconda/lib/python2.7/site-packages/labelImg/resources.py", line 10, in 
    from PyQt4 import QtCore
ImportError: No module named PyQt4

如未安装pyqt的话会报以下错误

Traceback (most recent call last):
  File "/Applications/anaconda/bin/labelImg", line 7, in 
    from labelImg.labelImg import main
  File "/Applications/anaconda/lib/python2.7/site-packages/labelImg/labelImg.py", line 24, in 
    from PyQt4.QtGui import *
ImportError: No module named PyQt4.QtGui
那么用pip 命令安装一下呢

pip install pyqt4

结果显示是不行的

Collecting pyqt4
  Could not find a version that satisfies the requirement pyqt4 (from versions: )
No matching distribution found for pyqt4
所以那就用conda 命令好了,如下

conda install pyqt=4

出现如下所示

Package plan for installation in environment /Applications/anaconda:

The following packages will be DOWNGRADED:

    pyqt: 5.6.0-py27hf21fe59_6 --> 4.11.4-py27_4
    qt:   5.6.2-2              --> 4.8.7-4

Proceed ([y]/n)?

输入 y 回车

等待安装完成

输入以下验证是否安装成功

labelImg
弹出窗口

一分钟搞定 Mac 安装labelImg_第1张图片

大功告成

安装过程中貌似以下的依赖包会受一些影响,但是目前来看其他模块用起来也没有任何问题,有问题可以评论区留言

    anaconda-navigator: 1.2.3-py27_0
    jupyter:            1.0.0-py27_3
    matplotlib:         1.5.1-np111py27_0
    pyqt:               4.11.4-py27_4
    qtconsole:          4.2.1-py27_0
    scikit-image:       0.12.3-np111py27_1
    seaborn:            0.7.1-py27_0
    spyder:             3.1.2-py27_0


你可能感兴趣的:(python,神经网络,机器学习)