在OS X上安装Numba时出错

时间:2016-04-03 13:07:26

标签: python osx-elcapitan numba

我无法在我的OS X系统上安装Numba(通过pip)。

我正在使用

  • Python:2.7.11(Homebrew)
  • pip:8.1.1
  • setuptools:20.6.7
  • OS X:10.11.4(x86_64)
  • Xcode:7.3
  • Xcode CLT:7.3.0.0.1.1457485338
  • Clang:7.3 build 703

并已使用

安装了先决条件(我认为)
brew install llvm
git clone https://github.com/numba/llvmlite
cd llvmlite
LLVM_CONFIG=/usr/local/opt/llvm/bin/llvm-config  python setup.py install
cd ..
rm -rf llvmlite

并尝试了

brew install llvm
brew link --force llvm  # later: brew unlink llvm
cd /usr/local/Cellar/llvm/X.X.X/include/llvm/Config/ # X.X.X = 3.6.2
ln -s llvm-config.h config.h

但我接着

pip install numba

给出

  Failed building wheel for llvmlite
  Running setup.py clean for llvmlite
Successfully built numba
Failed to build llvmlite
Installing collected packages: llvmlite, numba
  Running setup.py install for llvmlite ... 
  [...]        
    error: option --single-version-externally-managed not recognized

    ----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/pip-build-MY_vtC/llvmlite/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/pip-yoGGZY-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/b6/3rk65h797p7407x7d36sqn9c0000gn/T/pip-build-MY_vtC/llvmlite/

我对如何继续(没有Conda!)感到难过,并想知道是否有一些我缺少的简单修复。

3 个答案:

答案 0 :(得分:16)

这对我有用(在OS X 10.11.4上使用Homebrew Python):

brew install homebrew/versions/llvm37 --with-rtti
git clone https://github.com/numba/llvmlite
cd llvmlite
LLVM_CONFIG=/usr/local/Cellar/llvm37/3.7.1/bin/llvm-config-3.7 python setup.py install
LLVM_CONFIG=/usr/local/Cellar/llvm37/3.7.1/bin/llvm-config-3.7 pip install numba
rm -rf llvmlite

答案 1 :(得分:2)

或者您可以使用自制程序:

brew install homebrew/python/numba

答案 2 :(得分:0)

最简单的方法是安装miniconda而不是:

conda install numba

在Mac(和其他平台)上完美运行。

我建议先创建一个新环境:

conda create -n my_numba_env

激活它:

source activate my_numba_env

并安装numba:

conda install numba