我在Anaconda安装了rpy2。这是我运行的代码:
import rpy2.robjects as robjects
我输入错误(我已将用户名更改为" myuser"):
runfile('D:/Users/myuser/Documents/Python Scripts/regression_test.py', wdir='D:/Users/myuser/Documents/Python Scripts')
Traceback (most recent call last):
File "d:\Users\myuser\AppData\Local\Continuum\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py", line 2902, in run_code
self.showtraceback()
File "d:\Users\myuser\AppData\Local\Continuum\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py", line 1830, in showtraceback
value, tb, tb_offset=tb_offset)
File "d:\Users\myuser\AppData\Local\Continuum\Anaconda2\lib\site-packages\IPython\core\ultratb.py", line 1392, in structured_traceback
self, etype, value, tb, tb_offset, number_of_lines_of_context)
File "d:\Users\myuser\AppData\Local\Continuum\Anaconda2\lib\site-packages\IPython\core\ultratb.py", line 1309, in structured_traceback
self, etype, value, elist, tb_offset, number_of_lines_of_context
File "d:\Users\myuser\AppData\Local\Continuum\Anaconda2\lib\site-packages\IPython\core\ultratb.py", line 640, in structured_traceback
lines = ''.join(self._format_exception_only(etype, value))
File "d:\Users\myuser\AppData\Local\Continuum\Anaconda2\lib\site-packages\IPython\core\ultratb.py", line 752, in _format_exception_only
Colors.Normal, s))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xbf in position 18: ordinal not in range(128)
我的软件版本:
有人知道如何处理吗?
答案 0 :(得分:0)
回溯未显示涉及的rpy2代码,regression_test.py
的详细信息未知。
我见过与Spyder有关unicode相关问题的报道。您可以尝试使用Python 3而不是Python 2吗? Python 3使字符串的处理更加一致,并且可以解决问题。