OSX Lion 上的 rpy2 错误

发布于 2024-11-27 12:12:49 字数 610 浏览 2 评论 0原文

我已经尝试从源(python setup.py install)和macports安装rpy2(成功终止),并且在尝试导入rpy2时,我收到此错误:

/Library/Python/2.7/site-packages/rpy2/rinterface/__init__.py in <module>()
     76 
     77 
---> 78 from rpy2.rinterface._rinterface import *
     79 
     80 

ImportError: dlopen(/Library/Python/2.7/site-packages/rpy2/rinterface/_rinterface.so, 2): Library not loaded: /Library/Frameworks/R.framework/Versions/2.13/Resources/lib/libR.dylib
  Referenced from: /Library/Python/2.7/site-packages/rpy2/rinterface/_rinterface.so
  Reason: image not found

我似乎无法弄清楚这一点,有什么想法吗?

谢谢!

I've tried the installation (which terminates successfully) of rpy2 both from source (python setup.py install) and macports, and upon trying to import rpy2, I'm getting this error:

/Library/Python/2.7/site-packages/rpy2/rinterface/__init__.py in <module>()
     76 
     77 
---> 78 from rpy2.rinterface._rinterface import *
     79 
     80 

ImportError: dlopen(/Library/Python/2.7/site-packages/rpy2/rinterface/_rinterface.so, 2): Library not loaded: /Library/Frameworks/R.framework/Versions/2.13/Resources/lib/libR.dylib
  Referenced from: /Library/Python/2.7/site-packages/rpy2/rinterface/_rinterface.so
  Reason: image not found

I can't seem to figure this out, any idea?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傲娇萝莉攻 2024-12-04 12:12:49

Python 绑定依赖于有效的 R 安装。根据显示的文件路径,您提供的回溯必须来自源安装,并且没有找到 R 框架或库,如果已安装,这些框架或库不会位于该位置 (/Library/Frameworks)由 MacPorts 提供。最好的选择是坚持使用完整的 MacPorts 解决方案。这就提出了您安装的 rpy2 绑定版本的问题。目前,MacPorts 显示了三个可用版本:py25-rpy2py26-rpy2py27-rpy2。每一个都安装到相应的 MacPorts Python 版本中。因此,如果您安装了 py27-rpy2,则需要调用 MacPorts python2.7。从终端 shell 尝试:

/opt/local/bin/python2.7

The Python bindings depend on a working R installation. Based on the file paths shown, the traceback you give must be from your source install and it is not finding the R framework or libraries, which would not be in that location (/Library/Frameworks) if installed by MacPorts. Your best bet is to stick with the complete MacPorts solution. That raises the question of which version of the rpy2 bindings you installed. At the moment, MacPorts shows three available versions: py25-rpy2, py26-rpy2, and py27-rpy2. Each one is installed into the corresponding MacPorts Python version. So if you installed py27-rpy2, you need to invoke the MacPorts python2.7. From a terminal shell, try:

/opt/local/bin/python2.7
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文