使用自制软件Python在Mac 10.8上进行scipy安装的正确位置是什么?(What is the proper location for scipy installation on Mac 10.8 with homebrew Python?)

我遵循了大多数pythonistas的建议并设置了一个不同版本的Python,而不是Mac OS X中内置的版本。扫描后,似乎处理事情的最好方法是使用homebrew ,然后跟进pip 。 一切都很好,通过numpy ,然后事情变得糟糕。 我不能得到scipy安装或matplotlib 。 在StackOverflow搜索并尝试了一些解决方案之后,我终于偶然发现了Chris Fonnesbeck的“Scipy Superpack ” ,它承诺:

安装Numpy(1.8)和Scipy(0.12),Matplotlib(1.3),iPython(0.14),Pandas(0.10),Statsmodels(0.5.0),Scikit-Learn 0.13以及PyMC(2.2)的最新64位版本)对于Intel Macintosh上的OS X 10.8(Mountain Lion)。

这听起来对我的诺贝耳听起来很棒,但是当我查看安装脚本install_superpack.sh ,它似乎正在指导使用系统的python版本:

#!/bin/sh PYTHON='/usr/bin/python' GIT_FILENAME='git-1.7.7.3-intel-universal-snow-leopard' GIT_VOLUME='/Volumes/Git 1.7.7.3 Snow Leopard Intel Universal/' GFORTRAN='gcc-42-5666.3-darwin11.pkg' SUDO='sudo'

我应该更改上面的PYTHON变量还是保留它并调整PYTHON ENVIRONMENT(是吗?!不!?)我在其他地方读过的东西? 我还应该编辑什么? 或者我应该放弃这个脚本,因为我显然不在我的深处?

我应该注意到,我非常希望能在我的机器上运行matplotlib ,因为我喜欢为我正在追求的文本分析制作直方图。

I followed the advice of most pythonistas and set up a different version of Python with which to play than the one that comes built into Mac OS X. After scanning around, it seemed like the best way to handle things was to use homebrew, and then to follow up with pip. All was good up through numpy, and then things went bad. I can't get scipy to install nor matplotlib. After searching here at StackOverflow and trying a number of solutions, I finally stumbled across Chris Fonnesbeck's "Scipy Superpack", which promises to:

install recent 64-bit builds of Numpy (1.8) and Scipy (0.12), Matplotlib (1.3), iPython (0.14), Pandas (0.10), Statsmodels (0.5.0), Scikit-Learn 0.13, as well as PyMC (2.2) for OS X 10.8 (Mountain Lion) on Intel Macintosh.

That all sounds great to my noobie ears, but when I look at the install script, install_superpack.sh, it seems to be directing things to work with the system's version of python:

#!/bin/sh PYTHON='/usr/bin/python' GIT_FILENAME='git-1.7.7.3-intel-universal-snow-leopard' GIT_VOLUME='/Volumes/Git 1.7.7.3 Snow Leopard Intel Universal/' GFORTRAN='gcc-42-5666.3-darwin11.pkg' SUDO='sudo'

Should I change the PYTHON variable above or leave it be and make adjustments to the PYTHON ENVIRONMENT (yes?! No!?) thingamabob I have read about elsewhere? What else, if anything, should I edit? Or should I just back away from this script since I clearly am out of my depth?

I should note that I would dearly love to get matplotlib running on my machine because I'd like to play with making histograms for some text analysis I am pursuing.

最满意答案

superpack是为Apple python编译的。 它可能适用于自制软件中的python,但不建议这样做。

顺便说一下,当你说:

似乎处理事情的最好方法是使用自制软件,然后用pip跟进

如果这是真的,那么人们在使用自制软件/点子安装scipy时遇到麻烦就不会有大量问题。 Homebrew和pip非常适合简约,纯粹的python包。 但是他们用scipy或需要外部非python包的包裹绊倒了。

由于Macports现在有一个OSX 10.8的buildbot,我个人认为没有理由为什么有人想用homebrew / pip来进行科学的python安装。 通过良好的互联网连接,安装完整设置需要几分钟,您可以根据需要使用matplotlib和尽可能多的后端。

The superpack was compiled for the Apple python. It might work with your python from homebrew, but it's not recommended.

And by the way, when you say:

it seemed like the best way to handle things was to use homebrew, and then to follow up with pip

If this was true, then there wouldn't be a ton of questions here of people having trouble installing scipy with homebrew/pip. Homebrew and pip are great for minimalistic, pure python packages. But they stumble spectacularly with scipy or packages that require external non-python packages.

With Macports now having a buildbot for OSX 10.8, I personally see no reason why anyone would want to bother with homebrew/pip for a scientific python install. With a good internet connection it will take minutes to install a full setup, and you can have matplotlib with as many backends as you want.

更多推荐