在 windows 10 上安装 rpy2 时出错

Error in install rpy2 on windows 10

我在计算机上使用 pip to install rpy2 时遇到此错误:

C:\Python27\Scripts>pip install rpy2
Collecting rpy2
  Using cached rpy2-2.8.2.tar.gz
    Complete output from command python setup.py egg_info:
    Warning: 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 c:\users\isaac\appdata\local\temp\pip-build-_n5cg0\rpy2\

我认为这只是我计算机上 R 目录的一个错误。如何在 pip 上指示正确的目录?

问题已解决,我只是下载 rpy2.whl 并在此处添加此路径 https://www.reddit.com/r/learnpython/comments/3npm2b/tutorial_how_to_install_rpy2_on_windows_to_bridge/

将环境变量 R_HOME 添加到您的环境应该会有所帮助:

  1. 下载Anaconda and Miniconda
  2. 运行 conda install -c r rpy2 在您的终端