Error when using pyinstaller: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff

后端 未结 5 2253
不思量自难忘°
不思量自难忘° 2020-12-13 21:09

I have an issue when i compile a PyQt code with pyinstaller.

I use this line to compile:

c:\\Anaconda3\\Scripts\\pyinstaller.exe -y -F --distpath=\".         


        
相关标签:
5条回答
  • 2020-12-13 21:21

    In the newest version (3.5) , the line moved slightly to 427.

    The best thing to do is to search for

    out = out.decode(encoding)
    

    and replace it with

    out = out.decode(encoding, "replace")
    

    I don't understand why they do not fix this annoying problem!

    0 讨论(0)
  • 2020-12-13 21:22

    Changing compat.py works for me: out = out.decode(encoding, "replace")

    This is a known problem on pyinstaller and the developers are working on it. https://github.com/pyinstaller/pyinstaller/pull/3895

    I hope this bug will solved on the next update.

    0 讨论(0)
  • 2020-12-13 21:22

    The error is fixed since Version 4.0

    pip install "pyinstaller>=4.0.0"
    
    0 讨论(0)
  • 2020-12-13 21:31

    I found an answer on another forum. I change the line number 369 in the Python\Lib\site-packages\Pyinstaller\compat.py file:

    out = out.decode(encoding)
    

    to

    out = out.decode(encoding, errors='ignore')
    

    or

    out = out.decode(encoding, "replace")
    

    Now I can compile my script without any issue. I still don't know why my issue happened in the first place but at least that compiles now.

    0 讨论(0)
  • 2020-12-13 21:39

    The answer still works 2 years later BUT the line changed from 368 to 428.

    0 讨论(0)
提交回复
热议问题