ImportError: No module named astropy, after installing astropy in Anaconda

ImportError: No module named astropy, after installing astropy in Anaconda

所以我正在尝试使用 Astropy 并且我确实下载了它。但是,我收到一个错误。我想在 Python 2 而不是 Python 3 工作。

代码只是:

import astropy
astropy.test()

这是给出的错误:

Traceback (most recent call last):
  File "/Users/....../Random.py", line 1, in <module>
  import astropy
  ImportError: No module named astropy

在 shell 尝试一些事情来检查您的环境并可能了解您的问题:

which python
which conda
conda list

基本上,修复是删除 Python 3.4,删除目录,重新安装 2.7 和 Pypm Astropy。不确定到底发生了什么,但这就是解决方法...