首页 > 解决方案 > 无法使用 Raspberry pi 和 Windows 10 终端在 Python 3.5 中打印完整块

问题描述

命令print(u'\u2588')在 Python 在线编译器https://repl.it/languages/python3中运行良好,但在 Raspberry pi 中通过使用 Putty 的 Windows 10 终端运行良好。出现以下错误:

>>> print('\u2588')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\u2588' in position 0: ordinal not in range(128)

如果有人可以提供帮助,我会很高兴...

标签: python-3.xraspberry-pi3

解决方案


使用 Python 3.7.3 全新安装 Raspbian Buster 解决了问题(以前我有 Python 3.5)。这可能是根本原因...


推荐阅读