ubuntu上,原本整體複制了一個labelImg的檔案夾,運作labelImg就可以用,但這兩天突然報錯ImportError: No module named PyQt4.QtCore。
似乎是因為我使用的是pyqt5,但pyqt5沒有string這個類,找到解決方法:在labelImg檔案夾下編輯 libs/ustr.py這個檔案,修改插入如下代碼
try:
from PyQt4.QtCore import QString
except ImportError:
# we are using Python3 so QString is not defined
QString = str
然後,python labelImg.py就可以用了