Python systemr命令和shell输出不同

Python systemr命令和shell输出不同,python,r,shell,anaconda,Python,R,Shell,Anaconda,我的系统中安装了ubuntu的默认python和Anaconda python。在R中运行系统命令时: > system('which python') /usr/bin/python 然而,壳牌公司: user@user:~/Documents/Rad/jee/Solver$ which python /home/user/anaconda2/bin/python 也可以从Rscript命令行模式: user@user:~/Documents/Rad/jee/Solver$ Rscr

我的系统中安装了ubuntu的默认python和Anaconda python。在R中运行系统命令时:

> system('which python')
/usr/bin/python
然而,壳牌公司:

user@user:~/Documents/Rad/jee/Solver$ which python
/home/user/anaconda2/bin/python
也可以从Rscript命令行模式:

user@user:~/Documents/Rad/jee/Solver$ Rscript -e "system('which python')"
/home/user/anaconda2/bin/python

R系统命令中可能有什么不同之处,以提供不同的输出。

经过一些调试后,我通过Anaconda在path中添加python可执行路径的方式找到了答案。Anaconda将其添加到.bashrc中,该文件仅在bash中可用,以便我在终端中执行任何操作时可以看到它。然而,看起来R系统命令发出了sh调用。因此,anaconda python在R系统命令输出中不可用


将anaconda设置从.bashrc移动到.profile文件后;问题已解决。

路径环境变量不同。谢谢@OrtomalaLokni