gpt4 book ai didi

python - 无法在 MAC OS 中通过 pip 安装 rpy2

转载 作者:太空宇宙 更新时间:2023-11-03 16:48:23 26 4
gpt4 key购买 nike

我无法在 MAC OS 中通过 pip 或 PyCharm 安装 rpy2(Python 包)。
但我可以成功运行Python(通过PyCharm)和R(通过RStudio)......
主要错误信息是

"Error: Tried to guess R's HOME but no command (R) in the PATH." and "Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-OtKzsd/rpy2/".

我猜问题可能与 R 环境 PATH 设置有关?
但我还是不知道如何解决这个问题......
完整的错误消息如下:

host-217:~ ChenGuanYing$ sudo pip install rpy2
The directory '/Users/ChenGuanYing/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/ChenGuanYing/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting rpy2
Downloading rpy2-2.7.8.tar.gz (178kB)
100% |████████████████████████████████| 184kB 1.1MB/s
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 /private/tmp/pip-build-OtKzsd/rpy2/

enter image description here

最佳答案

错误消息中建议的两种可能的解决方案:

  1. 导出 R_HOME=
  2. 将 R 命令放入系统路径

关于python - 无法在 MAC OS 中通过 pip 安装 rpy2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36107119/

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