gpt4 book ai didi

python - 如何在 colab.research 上安装 rpy2?

转载 作者:太空宇宙 更新时间:2023-11-03 21:19:55 25 4
gpt4 key购买 nike

如何在 colab.research.google 上安装 rpy2?我尝试了以下命令:

pip install rpy2 
import rpy2

但它不起作用。这是得到的错误:

Collecting rpy2
Using cached https://files.pythonhosted.org/packages/02/d1/074ffbbe7b4bf74c60b75d74c8e67a1e4515b0d85f85cd6540e39610754a/rpy2-2.9.5.tar.gz
Complete output from command python setup.py egg_info:
Error: Tried to guess R's HOME but no command 'R' in the PATH.

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-je87ula0/rpy2/

---------------------------------------------------------------------------

ModuleNotFoundError Traceback (most recent call last)

<ipython-input-15-93ecdf466471> in <module>()
1 get_ipython().system('pip install rpy2')
----> 2 import rpy2

ModuleNotFoundError: No module named 'rpy2'

预先感谢您的帮助,伊内斯。

最佳答案

编写 !pip install rpy2 而不是 pip install rpy2

编辑

根据rpy2的文档可以找到here :

Running Rpy2 will require compiled libraries for R, Python, and readline; building rpy2 will require the corresponding development headers (check the documentation for more information about building rpy2).

所以,这应该有效

!apt-get install r-base
!pip install rpy2

关于python - 如何在 colab.research 上安装 rpy2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54371616/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com