Install Numpy on Mac OS X Lion 10.7

前端 未结 9 1032
萌比男神i
萌比男神i 2020-12-18 10:27

I need to install Numpy on my Mac OS X Lion 10.7. I googled a little bit, it seems like there are a lot of stuff needs to be installed. And some says I need install Xcode be

相关标签:
9条回答
  • 2020-12-18 11:00

    Lion comes with numpy installed. It should already be there:

    $ python -c 'import numpy, numpy.version; print numpy, numpy.version.version'
    <module 'numpy' from '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/__init__.py'> 1.5.1
    
    0 讨论(0)
  • Generally, unless you have a good reason you might want to avoid trying to have to build numpy/scipy et al. yourself.

    For Mac's there are two nice everything-included packages for numerical python. Enthough distribution (paid, http://www.enthought.com/) and Sagemath (free, http://www.sagemath.org/). I'm happily using Sagemath on 10.7 - it has numpy, scipy etc.

    0 讨论(0)
  • 2020-12-18 11:01

    A very easy route is to install Anaconda from Continuum, or Enthought's Canopy. These are python distributions that include numpy, as well as other useful scientific computing libraries

    0 讨论(0)
  • 2020-12-18 11:02

    For anyone that hits this from google, here is where I figured out how to build numpy on Mac OS.

    http://www.scipy.org/Installing_SciPy/Mac_OS_X

    On lion, it amounts to setting some environment variables (after Xcode is installed):

    export CC=gcc-4.2
    export CXX=g++-4.2
    export FFLAGS=-ff2c
    

    Then pip install numpy works just fine.

    0 讨论(0)
  • 2020-12-18 11:09

    I have used a few software packages that require a fresh install of NumPy, that won't work with the built in NumPy or even with the built-in Python. The easiest way to install NumPy on the mac is to download any of these packages. This will work for most OS versions.

    • Python 2.7
    • Python 2.6
    • Python 2.5

    Still the other answers are valid, though this is a more general answer.

    This is the SourceForge page of the project.

    0 讨论(0)
  • 2020-12-18 11:09

    If you do install Xcode you can get the latest and greatest open source libraries and packages. Consider using the excellent Mac Ports (http://www.macports.org) project. It is a package manager that will download source packages and their dependencies and build all the libraries and tools for you.

    Installing Numpy becomes a one line command once Xcode and mac ports is installed:

    sudo port install py27-numpy

    0 讨论(0)
提交回复
热议问题