python numpy库安装 mac_numpy 在mac os安装

Install notes for Mac OS X (10.9)

These instructions assume you’re starting with a clean Mac OS X system, which will need python3 and all scientific packages installed. These instructions are based off an excellent guide and are the result of extensive attempts to properly install numpy and scipy in particular (including building directly from source).

Mac OS X cookbook#!bash

# Homebrew

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

brew update

brew doctor

# ** Fix any errors raised by brew doctor before proceeding **

# Prep system

brew install gcc

brew install swig

# Python 3

brew install python3

# Scientific packages for Python 3

brew tap homebrew/science

brew install suite-sparse

pip3 install nose

pip3 install numpy

pip3 install scipy

pip3 install sympy

brew install libpng

brew install freetype

pip3 install matplotlib

# MPI

brew install openmpi

pip3 install mpi4py

# FFTW

brew install fftw --with-mpi

# HDF5

brew install hdf5

pip3 install h5py

# Dedalus

# ** Change to the directory where you want to keep the Dedalus repository **

brew install hg

hg clone https://bitbucket.org/dedalus-project/dedalus2

cd dedalus2

pip3 install -r requirements.txt

python3 setup.py build_ext --inplace

Detailed install notes for Mac OS X (10.9)

Preparing a Mac system

First, install Xcode from the App Store and seperately install the Xcode Command Line Tools. To install the command line tools, open Xcode, go to Preferences, select the Downloads tab andComponents. These command line tools install make and other requisite tools that are no longer automatically included in Mac OS X (as of 10.8).

Next, you should install the Homebrew package manager for OS X. Run the following from the Terminal:#!bash

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

brew update

brew doctor

Cleanup any problems identified by brew doctor before proceeding.

To complete the scipy install process, we’ll need gfortran from gcc and swig, which you can install from Homebrew:#!bash

brew install gcc

brew install swig

Install Python 3

Now, install python3 from Homebrew:#!bash

brew install python3

Scientific packages for Python3

Next install the numpy and scipy scientific packages. To adequately warn you before proceeding, properly installing numpy and scipy on a Mac can be a frustrating experience.

Start by proactively installing UMFPACK from suite-sparse, located in homebrew-science onhttps://github.com/Homebrew/homebrew-science. Failing to do this may lead to a series of perplexing UMFPACK errors during the scipy install.#!bash

brew tap homebrew/science

brew install suite-sparse

Now use pip, the (the standard Python package management system, installed with Python via Homebrew) to install nose, numpy, scipy, and sympy, in order:#!bash

pip3 install nose

pip3 install numpy

pip3 install scipy

pip3 install sympy

The scipy install can fail in a number of surprising ways. Be especially wary of custom settings toLDFLAGS, CPPFLAGS, etc. within your shell; these may cause the gfortran compile step to fail spectacularly.

Also install matplotlib, the main Python plotting library, along with its dependencies, using Homebrew and pip:#!bash

brew install libpng

brew install freetype

pip3 install matplotlib

Other libraries

Dedalus is parallelized using MPI, and we recommend using the Open MPI library on OS X. The Open MPI library and Python wrappers can be installed using Homebrew and pip:#!bash

brew install openmpi

pip3 install mpi4py

Dedalus uses the FFTW library for transforms and parallelized transposes, and can be installed using Homebrew:#!bash

brew install fftw --with-mpi

Dedalus uses HDF5 for data storage. The HDF5 library and Python wrappers can be installed using Homebrew and pip:#!bash

brew install hdf5

pip3 install h5py

Installing the Dedalus package

Dedalus is managed using the Mercurial distributed version control system, and hosted online though Bitbucket. Mercurial (referred to as hg) can be installed using homebrew, and can then be used to download the latest copy of Dedalus (note: you should change to the directory where you want the put the Dedalus repository):#!bash

brew install hg

hg clone https://bitbucket.org/dedalus-project/dedalus2

cd dedalus2

A few other Python packages needed by Dedalus are listed in the requirements.txt file in the Dedalus repository, and can be installed using pip:#!bash

pip3 install -r requirements.txt

You then need to build Dedalus’s Cython extensions from within the repository using the setup.pyscript. This step should be perfomed whenever updates are pulled from the main repository (but it is only strictly necessary when the Cython extensions are modified).#!bash

python3 setup.py build_ext --inplace

Finally, you need to add the Dedalus repository to the Python search path so that the dedalus2package can be imported. To do this, add the following to your ~/.bash_profile, substituting in the path to the Dedalus repository you cloned using Mercurial:# Add Dedalus repository to Python search path

export PYTHONPATH=:$PYTHONPATH

Other resources

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值