Pyinstaller exe在某些PC上不起作用(LookupError:未知编码:cp65001)

时间:2019-03-24 13:50:08

标签: python python-2.7 encoding pyinstaller

使用Pyinstaller(3.5.dev0 + 0ffa574bf)编译的可执行文件在某些​​PC上运行时崩溃(在其他PC上运行)。 Windows 10专业版。

Traceback (most recent call last):
File "*******.py", line 1, in <module>
  File "c:\users\sashako\appdata\local\temp\pip-install-tzzt7n\PyInstaller\PyInstaller\loader\pyimod03_importers.py", line 395, in load_module
  File "site-packages\pylab.py", line 1, in <module>
  File "c:\users\sashako\appdata\local\temp\pip-install-tzzt7n\PyInstaller\PyInstaller\loader\pyimod03_importers.py", line 395, in load_module
  File "site-packages\matplotlib\__init__.py", line 1131, in <module>
  File "site-packages\matplotlib\__init__.py", line 975, in rc_params
  File "site-packages\matplotlib\__init__.py", line 1100, in rc_params_from_file
  File "site-packages\matplotlib\__init__.py", line 1018, in _rc_params_in_file
  File "contextlib.py", line 17, in __enter__
  File "site-packages\matplotlib\__init__.py", line 1003, in _open_file_or_url
LookupError: unknown encoding: cp65001
[6292] Failed to execute script *******

在使用chcp 65001执行脚本之前,尝试在同一cmd窗口(和Power Shell)中转换为cp65001。也尝试了其他编码。

1 个答案:

答案 0 :(得分:0)

降级Pyinstaller为我解决了该问题。 pip install pyinstaller==3.1