在Mac上安装Rpy2出错了

时间:2015-02-12 14:35:44

标签: python r macos

我正在尝试在Mac Yosemite上安装Rpy2。我已经阅读了不同人提供的有关如何安装此软件包的所有帖子。没有什么对我有用,因为我的问题是具体的

我先做了

sudo easy_install pip

然后我做了

pip install rpy2 

但我有点像

Collecting rpy2
  Downloading rpy2-2.5.6.tar.gz (165kB)
    100% |################################| 167kB 2.4MB/s 
    R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
    /Library/Frameworks/R.framework/Resources/bin/R CMD config --ldflags
    /Library/Frameworks/R.framework/Resources/bin/R CMD config --cppflags
        Compilation parameters for rpy2's C components:
            include_dirs    = ['/Library/Frameworks/R.framework/Resources/include']
            library_dirs    = []
            libraries       = ['lzma', 'z', 'icucore', 'm', 'iconv']
            extra_link_args = ['-F/Library/Frameworks/R.framework/..', '-framework', 'R']
    R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
Collecting singledispatch (from rpy2)
  Downloading singledispatch-3.4.0.3-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from singledispatch->rpy2)
Installing collected packages: singledispatch, rpy2

  Exception:
  Traceback (most recent call last):
    File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/basecommand.py", line 232, in main
      status = self.run(options, args)
    File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/commands/install.py", line 347, in run
      root=options.root_path,
    File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_set.py", line 549, in install
      **kwargs
    File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_install.py", line 754, in install
      self.move_wheel_files(self.source_dir, root=root)
    File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_install.py", line 963, in move_wheel_files
      isolated=self.isolated,
    File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/wheel.py", line 234, in move_wheel_files
      clobber(source, lib_dir, True)
    File "/Library/Python/2.7/site-packages/pip-6.0.8-py2.7.egg/pip/wheel.py", line 212, in clobber
      shutil.copyfile(srcfile, destfile)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
      with open(dst, 'wb') as fdst:
  IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/singledispatch.py'

我尝试用

运行它
easy_install rpy2

然后我遇到了一些错误

error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-1490.pth'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /Library/Python/2.7/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://pythonhosted.org/setuptools/easy_install.html

Please make the appropriate changes for your system and try again. 

Finlly我以另一种方式做到了它显然有效

sudo easy_install rpy2

1 个答案:

答案 0 :(得分:0)

要检查已安装的软件包,请使用:

1 - 在Python shell /提示命令help('modules')

2 - 命令pip list

输出类似于:

  

瓶(0.12.7)cffi(0.8.6)特征(14.1.0)密码学   (0.6)cssselect(0.9.1)django-mongodb-engine(0.5.2)djangotoolbox   (1.6.2)folium(0.1.2)google-api-python-client(1.3.1)httplib2(0.9)   lxml(3.4.0)oauth2client(1.3.2)模式(2.6)Pillow(2.6.0)pip   (1.5.6)pyasn1(0.1.7)pyasn1-modules(0.0.5)pycparser(2.10)pymongo   (2.7.2)pyOpenSSL(0.14)queuelib(1.2.2)请求(2.4.3)rsa(3.1.4)   Scrapy(0.24.4)scrapyd(1.0.1)selenium(2.44.0)服务标识   (14.0.0)setuptools(3.6)simplejson(3.6.5)six(1.8.0)Twisted   (14.0.2)uritemplate(0.6)w3lib(1.10.0)wsgiref(0.1.2)   zope.interface(4.1.1)