(Comments)
[Solution] Pyinstaller UnicodeDecodeError: 'utf-8' codec can't decode byte
scipy version: 0.19.1
OS: Windows
Python 3.5
pyInstaller version: 3.2.1
To reproduce the issue, create a python file
scipy_test.py
from scipy import special
print(special)
In the same directory run the command
pyinstaller --onefile -c -a -y --clean scipy_test.py --debug > output.txt
It will generate this error
...
return exec_command(*cmdargs, **kwargs)
File "c:\users\hasee\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\compat.py", line 356, in exec_command
out = out.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xce in position 151: invalid continuation byte
Navigate to PyInstaller directory, in my case
C:\Users\hasee\AppData\Local\Programs\Python\Python35\Lib\site-packages\PyInstaller
First remove the __pycache__ folder, it contains some precompiled python file we are going to modify
Change python35\lib\site-packages\PyInstaller\compat.py, line 356 into this which handels the exception.
try:
out = out.decode(encoding)
except:
out = os.fsdecode(out)
That it, run the pyInstaller command and it should work!
Share on Twitter Share on Facebook
Comments