在Mac上安装rpy2时出错

Ang*_*R11 3 python installation rpy2

我试图在Mac OS High Sierra版本10.13.2上的python 2.7.14上安装rpy2,但是当我尝试编写命令时

pip install rpy2

我得到以下输出:

Collecting rpy2
  Using cached rpy2-2.9.2.tar.gz
    Complete output from command python setup.py egg_info:
    rpy2 is no longer supporting Python < 3. Consider using an older rpy2 release when using an older Python release.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/11/xgl2d8l16wd8xv2_lmdtcmwc0000gn/T/pip-build-aJMHfU/rpy2/
You are using pip version 9.0.1, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Run Code Online (Sandbox Code Playgroud)

我已经尝试通过输入来升级pip包

pip install --upgrade pip
Run Code Online (Sandbox Code Playgroud)

但我收到以下消息:

Requirement already up-to-date: pip in /usr/local/lib/python2.7/site-packages
You are using pip version 9.0.1, however version 9.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Run Code Online (Sandbox Code Playgroud)

我能够在python3上安装rpy2,但是由于某种原因它没有在python2上安装。

这是我的python2的规范:

Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 12:01:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激!

R.M*_*.M. 6

版本2.8.6是rpy2的最后一个版本,它支持2.x系列的Python。

您可以告诉pip具体安装该版本:

pip install rpy2==2.8.6
Run Code Online (Sandbox Code Playgroud)

为什么程序包管理器(其整个目的是处理依赖关系管理)为什么不能自行成功地解决这一问题,我不知道。