【发布时间】:2018-11-28 20:34:36
【问题描述】:
我有以下:
blocky = u'\u2588'
print blocky
当我在命令行中运行它时,一切都很好:
# python foo.py
█
然后我运行pyinstaller foo.py。没有错误。当我运行可执行文件时,出现此错误:
# ./foo
Traceback (most recent call last):
File "testall.py", line 2, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2588' in position 0: ordinal not in range(128)
[8029] Failed to execute script testall
我已经阅读了 python unicode how-to,但仍然很困惑。
编辑:为了澄清,我特别困惑为什么它在之前编译而不是之后
【问题讨论】:
-
呃,不完全是。特别是因为我已经阅读了操作方法。请参阅下面的解决方案。
标签: python-2.7 unicode pyinstaller