我试图在我的IPython控制台中“导入cv2”,但系统会出现UnicodeDecodeError
错误。
我目前使用的是“ascii”默认编码,但切换到“utf-8”并不能解决问题。我在主题上发现的其他帖子提到解析罪魁祸首输入字符串,但在我的情况下,它是在导入OpenCV包期间,所以我无法控制它。
知道发生了什么? (它曾经工作,但出于某种原因突然停止了。)
注意:在Ubuntu控制台上,编码为“utf-8”并且有效;低于完整的追溯:
import cv2
Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 3049, in run_code
self.showtraceback()
File "C:\Anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 1848, in showtraceback
value, tb, tb_offset=tb_offset)
File "C:\Anaconda\lib\site-packages\IPython\core\ultratb.py", line 1240, in structured_traceback
self, etype, value, tb, tb_offset, number_of_lines_of_context)
File "C:\Anaconda\lib\site-packages\IPython\core\ultratb.py", line 1157, in structured_traceback
self, etype, value, elist, tb_offset, number_of_lines_of_context
File "C:\Anaconda\lib\site-packages\IPython\core\ultratb.py", line 511, in structured_traceback
lines = ''.join(self._format_exception_only(etype, value))
File "C:\Anaconda\lib\site-packages\IPython\core\ultratb.py", line 623, in _format_exception_only
Colors.Normal, s))
UnicodeDecodeError: 'ascii' codec can't decode byte 0x92 in position 21: ordinal not in range(128)