在Mac 10.6.8上安装scipy [英] installing scipy on mac 10.6.8

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

问题描述

我尝试在Mac 10.6.8上安装 scipy ,但始终遇到问题.我已经安装了ipython(sudo /usr/bin/easy_install-2.6 ipython)和numpy(python setup.py build/install),但是当我以相同的方式安装scipy时,总是收到以下错误消息:

I try to install scipy on my mac 10.6.8 but always have problem with it. I've installed ipython (sudo /usr/bin/easy_install-2.6 ipython) and numpy (python setup.py build/install), but when I installed scipy by the same way, I got always this error message:

RuntimeError: Running cythonize failed!

有人可以告诉我如何解决这个问题吗?

Could someone tell me how to solve this problem?

推荐答案

您是否尝试过使用 binaries 提供给OSX吗?那应该确保一切正常.

Have you tried using the binaries provided for OSX? That should ensure everything works.

编辑

我发现保持包依赖关系最简单的方法就是尽可能使用 MacPorts ,因为与Homebrew不同,这些软件包设计为可一起使用,并且在尝试安装某些组件时(几乎总是)会自动安装依赖项.

The easiest way I've found to keep package dependencies under control is to use MacPorts as much as possible because unlike Homebrew, the packages are designed to work together and dependencies are (almost always) automagically installed when you try to install something.

因此,首先,使用安装程序对于雪豹.选择将端口安装在唯一目录中的选项,例如/opt/local,这样它们就不会与操作系统所依赖的任何内置版本冲突.另外,请确保在$PATH/bin/sbin等系统目录中将/opt/local/bin/opt/local/sbin添加到$PATH 之前,以便在运行从命令提示符中获取所需的版本.您的~/.profile的最后一行应类似于export PATH="/opt/local/bin:/opt/local/sbin:$PATH.

So, first, install MacPorts using the installer for Snow Leopard. Choose the option to install ports in a unique directory like /opt/local, so they don't conflict with whatever built-in versions the OS depends on. Also, ensure that /opt/local/bin and /opt/local/sbin are added to your $PATH before the system directories like /usr/bin, /bin, /sbin etc. so that when you run python from the command prompt you get the version you want. Your ~/.profile should have something like export PATH="/opt/local/bin:/opt/local/sbin:$PATH as its last line.

在安装MacPorts之后,您可能只是出于娱乐目的而重新启动,以确保正确设置了所有环境变量.启动Terminal.app(或您喜欢的替代软件),然后输入which port,如果一切正常,则应返回/opt/local/bin/port.接下来,运行sudo port selfupdate只是为了确保所有内容都正确同步.完成后,我们可以安装python和一些模块. port允许您传递要安装的端口的列表,因此类似sudo port install foo bar baz的命令将安装foobarbaz端口的最新版本,以及它们可能需要的任何依赖关系. ,以正确的顺序.一些端口具有二进制发行版,而其他端口则根据需要进行编译,因此,首次运行该端口时,可能需要很多依赖项来安装. MacPorts的一个不错的功能是您可以同时安装某些软件包的多个版本,并且可以根据需要在它们之间进行切换.另外,如果port search给出的结果过多,则在线搜索引擎可以帮助您找到什么您正在寻找.

After MacPorts has been installed, you may want to restart just for fun to ensure that all of your environment variable are set up properly. Start Terminal.app (or your favorite replacement) and enter which port, which should return /opt/local/bin/port if everything worked correctly. Next, run sudo port selfupdate just to make sure everything is synced properly. Once that is done, we can install python and some modules. port allows you to pass a list of ports to be installed, so a command like sudo port install foo bar baz will install the latest versions of the foo, bar, and baz ports, along with any dependencies they may require, in the correct order. Some ports have binary distributions, and others are compiled as needed, so the first time you run it there may be a lot of dependencies to install. A nice feature of MacPorts is that you can have multiple versions of some packages installed at the same time, and you can switch between them if needed. Also, if port search is giving too many results, the online search engine can help you find what you're looking for.

要运行一个不错的基于IPython的Python 2开发环境,您需要满足以下条件:

To get a decent IPython-based Python 2 development environment going, you'll need the following:

  • python27
  • py27-ipython
  • py27-numpy
  • py27-scipy
  • py27-matplotlib(如果您喜欢绘制漂亮的图片,但主要是为了获得pylab)
  • py27-pandas(DataFrame是您的朋友!)
  • ,如果您通过qtconsole选项运行ipython,则可能是py27-pyqt4
  • python27
  • py27-ipython
  • py27-numpy
  • py27-scipy
  • py27-matplotlib (if you like drawing pretty pictures, but mainly so you can get pylab)
  • py27-pandas (DataFrames are your friend!)
  • and perhaps py27-pyqt4 if you run ipython via the qtconsole option

我还将安装py-pippy27-distribute,以便在没有MacPort版本的情况下可以自行安装模块.

I'd also install py-pip and py27-distribute so you can install modules on your own if there is no MacPort version.

最后,如果您是前瞻性人士,并且想使用numpy等.在Python 3上,MacPorts可以满足您的要求!上述所有软件包都有基于py32-和py33的版本,除了scipy(目前仅为py32).但是,尽管我的机器上还有很多其他开发工具,而且我正在运行10.8.2,所以我可以用pip很好地安装它.

Finally, if you're a forward-looking person and want to use numpy et al. on Python 3, MacPorts has you covered! There are py32- and py33-based versions of all of the above packages except scipy, which is only py32 for now. However, I was able to install it just fine with pip, although I have a whole bunch of other devel tools on my machine, and I'm running 10.8.2, so YMMV.

祝你好运!

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

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