无法通过MAC OS中的pip安装rpy2

时间:2016-03-19 21:02:57

标签: python r macos pycharm rpy2

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

  

“错误:试图猜测R的HOME但在PATH中没有命令(R)。”和“命令”python setup.py egg_info“失败,错误代码1在/ private / tmp / pip-build-OtKzsd / rpy2 /".

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

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 个答案:

答案 0 :(得分:1)

两种可能的解决方案,如错误消息中所示:

  1. export R_HOME =
  2. 将R命令放入系统路径
相关问题