我刚刚用Python3.5重新安装了rpy2,我很难搞清楚为什么模块找不到" R-Home"。我已经在我的电脑上安装了R.我应该尝试重新安装R或其他方法吗?这里有一些帮助非常感谢!
import rpy2.rinterface
Traceback (most recent call last):
File "<ipython-input-7-676c977874d9>", line 1, in <module>
import rpy2.rinterface
File "/Users/JasonDucker/anaconda/lib/python3.5/site-packages/rpy2/rinterface/__init__.py", line 16, in <module>
tmp = subprocess.check_output(("R", "RHOME"), universal_newlines=True)
File "/Users/JasonDucker/anaconda/lib/python3.5/subprocess.py", line 629, in check_output
**kwargs).stdout
File "/Users/JasonDucker/anaconda/lib/python3.5/subprocess.py", line 696, in run
with Popen(*popenargs, **kwargs) as process:
File "/Users/JasonDucker/anaconda/lib/python3.5/subprocess.py", line 950, in __init__
restore_signals, start_new_session)
File "/Users/JasonDucker/anaconda/lib/python3.5/subprocess.py", line 1544, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'R'
答案 0 :(得分:1)
这意味着当python在子进程中调用“R RHOME”时,PATH
中没有可执行文件。
要克服此问题,请将路径添加到路径中。例如:
export PATH=/usr/local/some/place/bin:${PATH}