![](/img/trans.png)
[英]ModuleNotFoundError when running Python script in anaconda prompt
[英]UnicodeDecodeError when running Python in Anaconda Prompt
當我在 Anaconda Prompt 中運行python
時,出現以下錯誤。 它不會以任何可見的方式破壞我的 Python 體驗,但無論如何它仍然讓我感到不安。
知道為什么會這樣嗎?
我正在使用 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.