diff --git a/README.rst b/README.rst index 5c0c33d5..eadc49cf 100644 --- a/README.rst +++ b/README.rst @@ -119,6 +119,15 @@ Open cmd and go to the `labelImg <#labelimg>`__ directory python labelImg.py python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE] +If you want to package it into a separate EXE file + +.. code:: shell + + Install pyinstaller and execute: + + pip install pyinstaller + pyinstaller --hidden-import=pyqt5 --hidden-import=lxml -F -n "labelImg" -c labelImg.py -p ./libs -p ./ + Windows + Anaconda ^^^^^^^^^^^^^^^^^^ diff --git a/labelImg.py b/labelImg.py index a19a11f7..053cde0c 100755 --- a/labelImg.py +++ b/labelImg.py @@ -109,7 +109,10 @@ class MainWindow(QMainWindow, WindowMixin): # Load predefined classes to the list self.load_predefined_classes(default_prefdef_class_file) - self.default_label = self.label_hist[0] + if self.label_hist: + self.default_label = self.label_hist[0] + else: + print("Not find:/data/predefined_classes.txt (optional)") # Main widgets and related state. self.label_dialog = LabelDialog(parent=self, list_item=self.label_hist)