UnicodeEncodeError: 'charmap' codec can't encode character '\u2080' in position 28: character maps to <undefined>

UnicodeEncodeError: 'charmap' codec can't encode character '\u2080' in position 28: character maps to <undefined>

Anaconda\lib\encodings\cp1252.py", 第 19 行,在编码中 return codecs.charmap_encode(输入,self.errors,encoding_table)[0] UnicodeEncodeError:'charmap' 编解码器无法对位置 28 中的字符“\u2080”进行编码:字符映射到

你能帮帮我吗?

是的,切换到 Python 3.6+。来自 Windows 控制台的以下示例:

Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print u'\u2080'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\dev\Python27\lib\encodings\cp437.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u2080' in position 0: character maps to <undefined>

Python 3.3.5 (v3.3.5:62cf4e77f785, Mar  9 2014, 10:35:05) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print('\u2080')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\dev\Python33x64\lib\encodings\cp437.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2080' in position 0: character maps to <undefined>

Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print('\u2080')
₀