Python终端在打开后出现错误

2024-05-19 02:25:28 发布

您现在位置:Python中文网/ 问答频道 /正文

当我试图通过python命令从终端打开python时,我突然遇到了一个错误,终端正常工作,但我想了解为什么会发生这种情况,提前感谢

PS C:\Users\blackbird> py
AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Failed calling sys.__interactivehook__
Traceback (most recent call last):
  File "C:\Users\blackbird\AppData\Local\Programs\Python\Python38\lib\site.py", line 440, in register_readline
    readline.read_history_file(history)
  File "C:\Users\blackbird\AppData\Local\Programs\Python\Python38\lib\site-packages\pyreadline\rlmain.py", line 165, in read_history_file
    self.mode._history.read_history_file(filename)
  File "C:\Users\blackbird\AppData\Local\Programs\Python\Python38\lib\site-packages\pyreadline\lineeditor\history.py", line 82, in read_history_file
    for line in open(filename, 'r'):
  File "C:\Users\blackbird\AppData\Local\Programs\Python\Python38\lib\encodings\cp1254.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9e in position 886: character maps to <undefined>
>>>

Tags: inpyreadliblocallinesiteusers
1条回答
网友
1楼 · 发布于 2024-05-19 02:25:28

我注意到pyreadline包是无意中从“requirements.txt”文件安装到我的计算机上的

documentation

The pyreadline package is a python implementation of GNU readline functionality it is based on the ctypes based UNC readline package by Gary Bishop. It is not complete. It has been tested for use with windows 2000 and windows xp.
...
Version 2.1 of pyreadline has been verfied for Python 2.7, and 3.4, 3.5.

删除pyreadline包解决了这个问题

相关问题 更多 >

    热门问题