Mac M1芯片安装 labelImg
2021-09-28 本文已影响0人
杨康chin
十分艰难:最麻烦的是pyqt5的安装,最后才摸清门道
本文使用的是创建python虚拟环境的方法,其他方法试了不太行。
官方流程(并不太行):https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/training.html
首先直接用arm64框架安装pyqt5是不行的,不支持,要用Rosetta2。
1、制作Rosetta2终端:
![](https://img.haomeiwen.com/i22388565/8e734a04925cfc1e.png)
![](https://img.haomeiwen.com/i22388565/671bce0bd5ba439d.png)
![](https://img.haomeiwen.com/i22388565/4c6815050964d1c7.png)
![](https://img.haomeiwen.com/i22388565/976eddbc96466171.png)
![](https://img.haomeiwen.com/i22388565/c2d0ae947ca32026.png)
![](https://img.haomeiwen.com/i22388565/816284966d270a21.png)
![](https://img.haomeiwen.com/i22388565/55476ec6b848ac86.png)
Rosetta2终端制作完成,之后的安装都在Rosetta2中完成。
2、创建虚拟环境(这里要用/usr/bin的python3)
/usr/bin/python3 -m venv env
source env/bin/activate
pip install --upgrade pip
3、安装依赖包
pip install PyQt5 lxml
4、(4或5二选一)安装labelImg方法一
git clone https://github.com/tzutalin/labelImg.git
cd labelImg
python3 labelImg.py
labelImg.py这一步又可能报错:ModuleNotFoundError: No module named 'libs.resources'
解决方法:pyrcc5 -o libs/resources.py resources.qrc
然后继续python3 labelImg.py
打开方法就是python3 labelImg.py
或者更方便的,添加到环境
nano ~/.zshrc
###添加
alias labelImg='/Users/chenyangkang/env/bin/python /Applications/labelImg/labelImg.py'
source ~/.zshrc
之后直接labelImg就行了。但还是依旧得在Rosetta2终端下打开。
5、(4或5二选一)安装labelImg方法二
Rosetta2终端和env环境下直接pip
pip install labelImg
labelImg
(必须在Rosetta2终端和env环境下)
大功告成
用法:
python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]