【问题标题】:OSX installing numpy via brew for python3OSX 通过 brew 为 python3 安装 numpy
【发布时间】:2016-02-08 14:06:06
【问题描述】:

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

我输入:

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 ?

【问题讨论】:

    标签: python python-3.x numpy homebrew


    【解决方案1】:

    正确的安装方式是通过:

    pip3 install numpy
    

    显然,你需要先安装python3和pip。我测试并运行没有任何问题。

    【讨论】:

    • 谢谢,我知道 pip3 工作得很好。也许我不准确,我需要从 brew 安装。这是关于特定版本和其他依赖项的。
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-05
      • 2018-04-25
      • 2018-06-19
      • 1970-01-01
      • 2014-09-08
      相关资源
      最近更新 更多