Fix build error for qt5+py3

This commit is contained in:
tzutalin 2017-07-07 23:14:41 +08:00
parent 9899c131d1
commit 2d92e10529
2 changed files with 21 additions and 8 deletions

View File

@ -39,25 +39,38 @@ Linux/Ubuntu/Mac requires at least `Python
Ubuntu Linux Ubuntu Linux
^^^^^^^^^^^^ ^^^^^^^^^^^^
Python 2 + Qt4
.. code:: .. code::
sudo apt-get install pyqt4-dev-tools sudo apt-get install pyqt4-dev-tools
sudo pip install lxml sudo pip install lxml
make all make qt4py2
./labelImg.py python labelImg.py
./labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE] python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]
Python 3 + Qt5
.. code::
sudo apt-get install pyqt5-dev-tools
sudo pip3 install lxml
make qt5py3
python3 labelImg.py
python3 labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]
OS X OS X
^^^^ ^^^^
Python 2 + Qt4
.. code:: .. code::
brew install qt qt4 brew install qt qt4
brew install libxml2 brew install libxml2
make all make qt4py2
./labelImg.py python labelImg.py
./labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE] python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]
Windows Windows
^^^^^^^ ^^^^^^^
@ -101,7 +114,7 @@ Use Docker
-v /tmp/.X11-unix:/tmp/.X11-unix \ -v /tmp/.X11-unix:/tmp/.X11-unix \
tzutalin/py2qt4 tzutalin/py2qt4
make all;./labelImg.py make qt4py2;./labelImg.py
You can pull the image which has all of the installed and required dependencies. `Watch a demo video <https://youtu.be/nw1GexJzbCI>`__ You can pull the image which has all of the installed and required dependencies. `Watch a demo video <https://youtu.be/nw1GexJzbCI>`__

View File

@ -26,7 +26,7 @@ class PascalVocWriter:
""" """
rough_string = ElementTree.tostring(elem, 'utf8') rough_string = ElementTree.tostring(elem, 'utf8')
root = etree.fromstring(rough_string) root = etree.fromstring(rough_string)
return etree.tostring(root, pretty_print=True, encoding=ENCODE_METHOD).replace(' ', '\t') return etree.tostring(root, pretty_print=True, encoding=ENCODE_METHOD).replace(" ".encode(), "\t".encode())
# minidom does not support UTF-8 # minidom does not support UTF-8
'''reparsed = minidom.parseString(rough_string) '''reparsed = minidom.parseString(rough_string)
return reparsed.toprettyxml(indent="\t", encoding=ENCODE_METHOD)''' return reparsed.toprettyxml(indent="\t", encoding=ENCODE_METHOD)'''