在 Spyder 中导入 rpy2 时出现 UnicodeDecodeError
UnicodeDecodeError while importing rpy2 in Spyder
我已经在 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)
我的软件版本:
- 蟒蛇 4.0.0(64 位)
- Python 2.7.11
- R 3.3.1
- IPython 4.1.2
有人知道怎么处理吗?
traceback没有显示涉及的rpy2代码,regression_test.py
的细节未知
我看到有关 Spyder 的 unicode 相关问题的报告。您可以尝试使用 Python 3 而不是 Python 2 吗? Python 3 使字符串的处理更加一致,可能会解决问题。
我已经在 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)
我的软件版本:
- 蟒蛇 4.0.0(64 位)
- Python 2.7.11
- R 3.3.1
- IPython 4.1.2
有人知道怎么处理吗?
traceback没有显示涉及的rpy2代码,regression_test.py
的细节未知
我看到有关 Spyder 的 unicode 相关问题的报告。您可以尝试使用 Python 3 而不是 Python 2 吗? Python 3 使字符串的处理更加一致,可能会解决问题。