安装了Anaconda后无法导入numpy

7

我刚安装了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

I get the error:

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
1个回答

4

我最终卸载了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。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接