ggplot2不存在于python的rpy2中? [英] ggplot2 not present in rpy2 for python?
本文介绍了ggplot2不存在于python的rpy2中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Python3.2中使用rpy2 v2.1.9,我不明白为什么我不能使用库ggplot2
import rpy2
from rpy2.robjects import r
r.library(ggplot2)
这里是我得到的错误消息
函数错误(package,help,pos = 2, lib.loc = NULL,character.only = FALSE,:
没有包名为'ggplot2'
Traceback(最近一次调用最后一个):
文件< stdin>,line 1,在< module>
文件中/usr/local/lib/python3.2/dist-packages/rpy2/robjects/functions.py,第82行,在__call__
return super(SignatureTranslatedFunction ,self).__ call __(* args,** kwargs)
文件/usr/local/lib/python3.2/dist-packages/rpy2/robjects/functions.py,第34行,在__call__
res = super(Function,self).__ call __(* new_args,** new_kwargs)
rpy2.rinterface.RRuntimeError:函数错误(package,help,pos = 2,lib.loc = NULL,只有= FALSE,:
没有包名为'ggplot2'
解决方案
查看第一条错误消息的尾部:
没有名为'ggplot2'的包
您需要首先安装 ggplot2
包。激发R本身,并说
pre $ $ $ $ $ install.packages(ggplot2)
I am working with rpy2 v2.1.9 in Python3.2, I don't understand why I can't use the library ggplot2
import rpy2
from rpy2.robjects import r
r.library("ggplot2")
Here is the error message I got
Error in function (package, help, pos = 2, lib.loc = NULL, character.only = FALSE, :
there is no package called 'ggplot2'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.2/dist-packages/rpy2/robjects/functions.py", line 82, in __call__
return super(SignatureTranslatedFunction, self).__call__(*args, **kwargs)
File "/usr/local/lib/python3.2/dist-packages/rpy2/robjects/functions.py", line 34, in __call__
res = super(Function, self).__call__(*new_args, **new_kwargs)
rpy2.rinterface.RRuntimeError: Error in function (package, help, pos = 2, lib.loc = NULL, character.only = FALSE, :
there is no package called 'ggplot2'
解决方案
See the tail of the first error message:
there is no package called 'ggplot2'
You need to install the ggplot2
package first. Fire up R itself, and say
install.packages("ggplot2")
这篇关于ggplot2不存在于python的rpy2中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文