简体   繁体   English

在 Anaconda Prompt 中运行 Python 时出现 UnicodeDecodeError

[英]UnicodeDecodeError when running Python in Anaconda Prompt

When I run python in Anaconda Prompt, I get the following error.当我在 Anaconda Prompt 中运行python时,出现以下错误。 It does not disrupt my Python experience in any visible way, but it still unnerves me regardless.它不会以任何可见的方式破坏我的 Python 体验,但无论如何它仍然让我感到不安。

Any idea on why this is happening?知道为什么会这样吗?

I'm using 2019/03 version of Anaconda with Python 3.7.3我正在使用 2019/03 版本的 Anaconda 和 Python 3.7.3

(base) C:\Users>python
Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 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 "C:\Users\Anaconda3\lib\site.py", line 439, in register_readline
    readline.read_history_file(history)
  File "C:\Users\Anaconda3\lib\site-packages\pyreadline\rlmain.py", line 165, in read_history_file
    self.mode._history.read_history_file(filename)
  File "C:\Users\Anaconda3\lib\site-packages\pyreadline\lineeditor\history.py", line 82, in read_history_file
    for line in open(filename, 'r'):
  File "C:\Users\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 2990: character maps to <undefined>

del %userprofile%\\.python_history删除了带有无法为我显示的字符的Python历史文件并解决了问题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM