配置如下
macos 10.12
python 3.6
tensorflow 2.1
在终端安装好了(默认是)最新版本的sip和pyqt5后调用labelImg报错如下
(tensorflow) 123deiMac:Downloads a123$ labelImg
Traceback (most recent call last):
File "/Applications/anaconda3/envs/tensorflow/lib/python3.6/site-packages/labelImg/labelImg.py", line 15, in <module>
from PyQt5.QtGui import *
ImportError: dlopen(/Applications/anaconda3/envs/tensorflow/lib/python3.6/site-packages/PyQt5/QtGui.abi3.so, 2): Symbol not found: _futimens
Referenced from: /Applications/anaconda3/envs/tensorflow/lib/python3.6/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libSystem.B.dylib
in /Applications/anaconda3/envs/tensorflow/lib/python3.6/site-packages/PyQt5/Qt/lib/QtCore.framework/Versions/5/QtCore
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/anaconda3/envs/tensorflow/bin/labelImg", line 5, in <module>
from labelImg.labelImg import main
File "/Applications/anaconda3/envs/tensorflow/lib/python3.6/site-packages/labelImg/labelImg.py", line 24, in <module>
import sip
ModuleNotFoundError: No module named 'sip'
在网上查询后估计是pyqt5与sip版本不匹配
先卸载sip和pyqt5
pip uninstall sip pyqt5 -y
再装上4.19.8的sip和5.12.1的PyQt5
pip install sip==4.19.8 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
pip install PyQt5==5.12.1 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com