在Mac上安装rpy2时出错

时间:2018-03-31 07:09:37

标签: python installation rpy2

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

mFirebaseInstance = FirebaseDatabase.getInstance(); mDatabase = mFirebaseInstance.getReference("usersDb/UserTable");

我得到以下输出:

pip install rpy2

我已经尝试通过输入

来升级pip包
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.

但我收到以下消息:

pip install --upgrade pip

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

以下是我的python2的规范:

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.

任何帮助都将深表感谢!

2 个答案:

答案 0 :(得分:4)

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

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

pip install rpy2==2.8.6

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

答案 1 :(得分:0)

它声明最新版本仅由python 3支持。

rpy2 is no longer supporting Python < 3. Consider using an older rpy2 release when using an older Python release.

如果你真的需要使用python 2,请尝试下载旧版本的rpy2和build it from source