无法使用 Python 在 Windows Powershell 或 WSL Linux 终端中显示表情符号

Sil*_*tya 8 python powershell python-3.x

我正在尝试使用 Python3 在 Windows Powershell 和 WSL Linux 终端中打印表情符号。

我尝试过使用 unicode、CLDR 名称,还安装了表情符号库。

print("\U0001F44D")
print(emoji.emojize(':thumbs_up:'))
Run Code Online (Sandbox Code Playgroud)

但在终端中,它只在框中显示一个问号。没有表情符号显示。

这里有什么问题呢?

但如果我在这里复制输出,它就会正确显示。像这样

小智 8

我认为任何 Windows Shell 都不支持表情符号/unicode 字符,或者可能不支持表情符号。

如果您使用 Windows,您可能想尝试Windows Terminal。它具有完整的表情符号支持,并且应该与 Powershell 和 WSL 一起使用。