当我尝试通过终端从终端打开 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>
>>>
我注意到pyreadline
软件包无意中从“requirements.txt”文件安装到我的计算机上。
From 文档:
The pyreadline
package 是 GNU readline 的 python 实现
它的功能基于基于 ctypes 的 UNC readline 包
加里·毕肖普。它并不完整。它已经过测试,可与
Windows 2000 和 Windows XP。
...
2.1 版pyreadline
已针对 Python 2.7、3.4、3.5 进行验证。
去除pyreadline
包解决了问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)