2016-02-08 91 views
3

我无法通过brew为python3安装numpy。OSX通过brew for python3安装numpy

I型:

brew install numpy --with-python3 

那么它是python2

Python 2.7.6 (default, Sep 9 2014, 15:04:36) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import numpy 
>>> 

,但仍确定没有找到python3

Python 3.4.0 (v3.4.0:04f714765c13, Mar 15 2014, 23:02:41) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import numpy 
Traceback (most recent call last): 
File "<stdin>", line 1, in <module> 
ImportError: No module named 'numpy' 
>>> 

如何使它为python3工作?

回答

4

安装它正确的方法是通过:

pip3 install numpy 

显然,你需要安装python3和第一支托。我测试和工作没有任何问题。

+1

谢谢,我知道pip3工作得很好。也许我不太确切,我需要从brew安装。这是关于特定版本和其他依赖关系。 – speedingdeer

1

自制软件的问题是它只能看到系统的python和它自己安装的那个。所以你必须先通过brew安装python3,然后使用--with-python3选项。