在rPython中更改python的版本?
我试图在RStudio中使用rPython运行tensor flow,rPython使用的python版本与终端中的不同在rPython中更改python的版本?,python,r,version,rpython,Python,R,Version,Rpython,我试图在RStudio中使用rPython运行tensor flow,rPython使用的python版本与终端中的不同 如何更改rPython使用的版本?一种方法是重新安装rPython包并指定要使用的python版本: # Lets assume it is already connected to python 3.5.3 library(rPython)
如何更改rPython使用的版本?一种方法是重新安装rPython包并指定要使用的python版本:
# Lets assume it is already connected to python 3.5.3
library(rPython)
python.exec("import sys")
python.exec("print (sys.version)")
# 3.5.3 (default, Jan 19 2017, 14:11:04)
# [GCC 6.3.0 20170118]
# Now lets connect it instead to python 2.7.13
detach("package:rPython", unload=TRUE)
install.packages("rPython",lib= "/home/userid/R/x86_64-pc-linux-gnu-library/3.4", configure.vars= "RPYTHON_PYTHON_VERSION=2")
# omitted install reporting of rPython for space #
library(rPython)
python.exec("import sys")
python.exec("print (sys.version)")
# 2.7.13 (default, Jan 19 2017, 14:48:08)
# [GCC 6.3.0 20170118]