如何在Mac OS X上安装rpy2 [英] How to Install rpy2 on Mac OS X

查看:188
本文介绍了如何在Mac OS X上安装rpy2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,我正在尝试在Mac OSX上安装适用于python的rpy2的尝试,但未成功.我已经尝试了Macports和DarwinPorts,但是在python shell环境中

import rpy2

I am trying, so far unsuccessfully, at installing the rpy2 for python on my Mac OSX. I have tried Macports and DarwinPorts but have had no luck with

import rpy2


如果有人那么善良,我所追求的是简化"说明,以成功安装Mac OSX Snow Leopard的rpy2.希望这里有人成功完成了这项工作,并且可以概述他们采取的过程吗?至少那是我所希望的.

提前谢谢!


What I am after, if someone would be so kind, are "dumbed down" instructions for a successful install of rpy2 for Mac OSX Snow Leopard. Hopefully someone here has done this successfully and can outline the process they took? At least that is what I am hoping.

Many thanks in advance!

推荐答案

easy_install和rpy2可以很好地协同工作(确实做到了),但是您需要easy_install与特定的python版本同步.这归结为控制$ PATH和$ PYTHONPATH环境变量,以便出现的第一个Python目录是您想要的版本,并且也具有您想要的easy_install版本. 请勿尝试通过取出出厂安装的Python版本来解决此问题.

easy_install and rpy2 work fine together (just did it) but you need to have easy_install in sync with your specific python version. This comes down to controlling your $PATH and $PYTHONPATH environment variables so that the first Python directory that appears is the version you want and also has the easy_install version you want. Do not try to solve this by taking out the factory installed version of Python.

您在主目录中设置路径变量.如果您使用默认的bash shell,请检查.bash_profile中的

You set your path variables in your home directory. If you are using the default bash shell, check .bash_profile for

$ echo $ PYTHONPATH /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/

$ echo $PYTHONPATH /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/

这将告诉您搜索安装包的位置和顺序

which will tell you where and in what order installed packages are searched for

$ echo $ PATH

$ echo $PATH

/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:

/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:

我不建议您根据需要设置这些方法,而是鼓励您参考通常的资料,因为有些知识是危险的,并且通过合理但错误的猜测使Shell无法运行是真正的危险.

Rather than giving a recipe for how to set these if needed, I encourage you to consult the usual sources because a little knowledge is dangerous and rendering the shell inoperative by reasonable, but wrong, guesses is a real danger.

这篇关于如何在Mac OS X上安装rpy2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆