简体   繁体   中英

Installing SciPy on Mac OS Lion in Virtualenv

I am trying to install scipy in my vertualenv on mac.

Python using in 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:

$ 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)

python setup.py build

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

python setup.py install

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

pip install scipy

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

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

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 . As Steve Jobs says - it just works. Nothing more to do.

Steps to install scipy in a virtual env:

  • Download the scipy superpack install script
  • Open the install script and change PYTHON=/usr/bin/python to 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. Fixed in this commit: https://github.com/scipy/scipy/commit/effa6f68f8ada57b79864852b609ff06d2527306

It looks like this change has not yet been merged to SVN trunk. Try github instead:

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

That's worked for me on two installs of 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):

  1. Install macports
  2. sudo port install gcc40
  3. Create a symlink from gcc-4.0 to gcc
  4. Recommended: after scipy is installed, change the symlink to point back to the xcode version of gcc-4.2

Steps 1 & 2 are only needed if you don't already have gcc-4.0.

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:

  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)

  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).

  3. Scipy Superpack (this one is the easiest and fastest since it simply installs compiled binaries for Lion)

What about going with the official instructions ?

It seems you are using the default Python installation, which is not recommended...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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