简体   繁体   English

UnicodeDecodeError:“charmap”编解码器无法解码 position 2310 中的字节 0x81:字符映射到<undefined></undefined>

[英]UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 2310: character maps to <undefined>

I have recently been working on Python and have started to face this issue even when I just start the Python Interactive terminal using the command prompt.我最近一直在研究 Python,即使我刚刚使用命令提示符启动 Python 交互式终端,我也开始面临这个问题。 I referred this question but I have not been executing any python code as suggested in that question;我提到了这个问题,但我没有按照该问题的建议执行任何 python 代码; but am just entering the python shell using python command inside a fresh command prompt (PS: I am using Windows 10)但我只是在新的命令提示符中使用python命令输入 python shell 命令(PS:我正在使用 ZAEA23489CE3AA9B6406EBA24)

The error I seem to face is:我似乎面临的错误是:

C:\Users\>python
Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32

Type "help", "copyright", "credits" or "license" for more information.
Failed calling sys.__interactivehook__
Traceback (most recent call last):
  File "D:\anaconda3\lib\site.py", line 440, in register_readline
    readline.read_history_file(history)
  File "D:\anaconda3\lib\site-packages\pyreadline\rlmain.py", line 165, in read_history_file
    self.mode._history.read_history_file(filename)
  File "D:\anaconda3\lib\site-packages\pyreadline\lineeditor\history.py", line 82, in read_history_file
    for line in open(filename, 'r'):
  File "D:\anaconda3\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 2310: character maps to <undefined>

>>>

I don't find any line where I can add the "utf8" in any suggested lines.我没有找到任何可以在任何建议的行中添加"utf8"的行。

Try deleting .python_history file which would be under C:\Users\<user-name>\ .尝试删除.python_history C:\Users\<user-name>\下的 .python_history 文件。 There seem to be more gibberish in your history file.您的历史文件中似乎有更多的乱码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UnicodeDecodeError:“ charmap”编解码器无法解码位置40的字节0x81:字符映射到<undefined> - UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 40: character maps to <undefined> UnicodeDecodeError:“ charmap”编解码器无法解码位置49的字节0x81:字符映射到<undefined> - UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 49: character maps to <undefined> Python - UnicodeDecodeError:&#39;charmap&#39; 编解码器无法解码位置 44 中的字节 0x81:字符映射到<undefined> - Python - UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 44: character maps to <undefined> Python - UnicodeDecodeError:'charmap' 编解码器无法解码 position 中的字节 0x81 229393:: 字符映射到<undefined></undefined> - Python - UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 229393:: character maps to <undefined> UnicodeDecodeError:“ charmap”编解码器无法解码位置591处的字节0x8f:字符映射到<undefined> - UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 591: character maps to <undefined> UnicodeDecodeError:“charmap”编解码器无法解码 position 7736 中的字节 0x98:字符映射到<undefined></undefined> - UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 7736: character maps to <undefined> UnicodeDecodeError: 'charmap' 编解码器无法解码位置 668 中的字节 0x98:字符映射到<undefined></undefined> - UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 668: character maps to <undefined> UnicodeDecodeError:'charmap' 编解码器无法解码 position Y 中的字节 X:字符映射到<undefined></undefined> - UnicodeDecodeError: 'charmap' codec can't decode byte X in position Y: character maps to <undefined> Python-UnicodeDecodeError:“ charmap”编解码器无法解码位置1070的字节0x9d:字符映射到<undefined> - Python - UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1070: character maps to <undefined> UnicodeDecodeError:'charmap'编解码器无法解码7240位的字节0x8d:字符映射到<undefined> - UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 7240: character maps to <undefined>
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM