简体   繁体   English

在Virtualenv中的Mac OS Lion上安装SciPy

[英]Installing SciPy on Mac OS Lion in Virtualenv

I am trying to install scipy in my vertualenv on mac. 我想在我的vertualenv上安装scipy。

Python using in virtualenv: Python中使用的virtualenv:

(Django)miki725mac:Django miki725$ python
Python 2.7.2 (default, Aug  3 2011, 00:58:00) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

I tries installing scipy by doing this which fails: 我尝试通过这样做安装scipy失败:

$ svn co http://svn.scipy.org/svn/scipy/trunk scipy
$ python setup.py build
$ python setup.py install

Then I tried: 然后我尝试了:

$ pip install scipy

Also as per the suggestion I tried: 根据我尝试的建议:

$ pip install -e git://github.com/scipy/scipy@effa6f68f8ada57b7986#egg=scipy-dev

Logs 日志

Here are the complete logs for all the insallation steps: (they were too long for stackoverflow) 以下是所有安装步骤的完整日志:(它们对于stackoverflow来说太长了)

python setup.py build

http://www.diglo.com/download/3dfc7a1af18617d7ee49faa8bea3464703ea http://www.diglo.com/download/3dfc7a1af18617d7ee49faa8bea3464703ea

python setup.py install

http://www.diglo.com/download/ab13985c76ad709b25464fa1254daa4b03ea http://www.diglo.com/download/ab13985c76ad709b25464fa1254daa4b03ea

pip install scipy

http://www.diglo.com/download/9e808fe5b57b6b01a8265d4b01958da703ea (pastebin: http://paste.pocoo.org/show/454004/ ) http://www.diglo.com/download/9e808fe5b57b6b01a8265d4b01958da703ea (引擎收录: http://paste.pocoo.org/show/454004/

pip install -e git://github.com/scipy/scipy@effa6f68f8ada57b7986#egg=scipy-dev

http://www.diglo.com/download/085f7bd08e7cb86823718b94641ecacd03ea http://www.diglo.com/download/085f7bd08e7cb86823718b94641ecacd03ea

Please help. 请帮忙。 I am new at all this. 我是新生的。 Thank you in advance. 先感谢您。

Personally, I found the easiest and reliable way to install scipy/numpy on Mac OS Lion was through the scipy superpack shell-script on github . 就个人而言,我发现在Mac OS Lion上安装scipy / numpy的最简单可靠的方法是通过github上scipy superpack shell-script As Steve Jobs says - it just works. 史蒂夫乔布斯说 - 它只是有效。 Nothing more to do. 没什么可做的。

Steps to install scipy in a virtual env: 在虚拟环境中安装scipy的步骤:

  • Download the scipy superpack install script 下载scipy superpack安装脚本
  • Open the install script and change PYTHON=/usr/bin/python to PYTHON=`which python` 打开安装脚本并将PYTHON = / usr / bin / python更改为PYTHON =`which python`
  • Activate virtual env, and inside your virtual env, run the install script 激活虚拟环境,并在虚拟环境中运行安装脚本
  • Bingo! 答对了! that's all you need to do 这就是你需要做的一切

Up until August 2011 Scipy was broken on Mac OS X Lion. 截至2011年8月,Scipy在Mac OS X Lion上被打破。 Fixed in this commit: https://github.com/scipy/scipy/commit/effa6f68f8ada57b79864852b609ff06d2527306 在此提交中修复: https//github.com/scipy/scipy/commit/effa6f68f8ada57b79864852b609ff06d2527306

It looks like this change has not yet been merged to SVN trunk. 看起来此更改尚未合并到SVN中继。 Try github instead: 试试github:

pip install -e git://github.com/scipy/scipy@effa6f68f8ada57b7986#egg=scipy-dev

That's worked for me on two installs of Lion. 这对我来说有两个Lion安装。 However if it doesn't I've heard using GCC-4.0 (instead of the current default: GCC-4.2) also solves the issue (haven't verified it though): 但是,如果不是我听说过使用GCC-4.0(而不是当前的默认值:GCC-4.2)也解决了问题(虽然没有验证):

  1. Install macports 安装macports
  2. sudo port install gcc40 sudo port安装gcc40
  3. Create a symlink from gcc-4.0 to gcc 创建一个从gcc-4.0到gcc的符号链接
  4. Recommended: after scipy is installed, change the symlink to point back to the xcode version of gcc-4.2 建议:安装scipy后,更改符号链接以指向gcc-4.2的xcode版本

Steps 1 & 2 are only needed if you don't already have gcc-4.0. 只有在您还没有gcc-4.0时才需要步骤1和2。

I ran into similar problem recently. 我最近遇到了类似的问题。 After following the office doc for installing scipy on Lion to no avail, I found the following resources that helped me fix it: 在关于在Lion上安装scipyoffice文档无效之后,我发现以下资源帮助我解决了这个问题:

  1. Installing Python, virtualenv, NumPy, SciPy, matplotlib and IPython on Lion (didn't really work for me but I imagine it works for most people) 在Lion上安装Python,virtualenv,NumPy,SciPy,matplotlib和IPython (对我来说并没有真正起作用,但我认为它适用于大多数人)

  2. Install Python, NumPy, SciPy, and matplotlib on Mac OS X (this one works for me too, just remember to install gfortran with homebrew first, and then use pip install scipy to build and install scipy . Though I suspect it might not always work). 在Mac OS X上安装Python,NumPy,SciPy和matplotlib (这个也适用于我,只记得首先用homebrew安装gfortran ,然后使用pip install scipy来构建和安装scipy 。虽然我怀疑它可能并不总是有效)。

  3. Scipy Superpack (this one is the easiest and fastest since it simply installs compiled binaries for Lion) Scipy Superpack (这是最容易也是最快的,因为它只是为Lion安装已编译的二进制文件)

What about going with the official instructions ? 怎么跟官方指示一起去

It seems you are using the default Python installation, which is not recommended... 您似乎使用的是默认的Python安装,不推荐使用...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM