【问题标题】:Can't import numpy after Anaconda installed安装 Anaconda 后无法导入 numpy
【发布时间】:2016-02-22 07:17:32
【问题描述】:

我刚刚安装了 Anaconda 3.5。终端显示正确的版本,甚至在括号中包含 Continuum Analytics:

Python 3.5.0 |Continuum Analytics, Inc.| (default, Oct 20 2015, 14:39:26) 
[GCC 4.2.1 (Apple Inc. build 5577)] 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'

我知道 Anaconda 带有 numpy(我跑了conda list,只是为了确保)。有谁知道怎么回事?

我的.bash_profile 似乎与此有关。如果有,内容如下。

# Setting PATH for Python 2.7
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

# added by Anaconda3 2.3.0 installer
export PATH="/Users/username/anaconda/bin:$PATH"

# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH

【问题讨论】:

    标签: python numpy anaconda


    【解决方案1】:

    我最终卸载了 Anaconda 和所有版本的 Python 3。重新安装 Anaconda 后,numpy 可用。有趣的是,在有效的版本上,终端显示以下信息:

    Python 3.5.0 |Anaconda 2.4.0 (x86_64)| (default, Oct 20 2015, 14:39:26) 
    [GCC 4.2.1 (Apple Inc. build 5577)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    

    显然看到“Continuum Analytics”并意味着您正在使用 Anaconda。

    【讨论】:

      猜你喜欢
      • 2016-01-30
      • 2015-09-08
      • 2020-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-13
      • 1970-01-01
      相关资源
      最近更新 更多