ggplot2 不存在于 python 的 rpy2 中?

发布于 2024-12-06 07:22:21 字数 901 浏览 3 评论 0原文

我正在 Python3.2 中使用 rpy2 v2.1.9,我不明白为什么我不能使用库 ggplot2

import rpy2
from rpy2.robjects import r
r.library("ggplot2")

这是我收到的错误消息

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'

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'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

溇涏 2024-12-13 07:22:21

查看第一条错误消息的尾部:

没有名为“ggplot2”的包

您需要先安装 ggplot2 软件包。启动 R 本身,然后说

 install.packages("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")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文