-1

我有 Windows 8(遗憾的是,我很幸运,但是一台笔记本电脑支持非常糟糕的 Linux,尝试了几个发行版..)。我安装了 Python 2.7,也可以导入 scipy 和 numpy。我已经使用他们网站上的可执行文件安装了 astropy,但是当我尝试导入它时,我在下面收到错误消息。

Enthought Canopy Python 2.7.3 | 64-bit | (default, Jun 14 2013, 18:19:25) [MSC v
.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import astropy
Error in sys.excepthook:
Traceback (most recent call last):
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\User\lib\site-packages\astr
opy\logger.py", line 222, in _excepthook
    self.error(message)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.3.12
62.win-x86_64\lib\logging\__init__.py", line 1166, in error
    self._log(ERROR, msg, args, **kwargs)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.3.12
62.win-x86_64\lib\logging\__init__.py", line 1258, in _log
    self.handle(record)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.3.12
62.win-x86_64\lib\logging\__init__.py", line 1268, in handle
    self.callHandlers(record)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.3.12
62.win-x86_64\lib\logging\__init__.py", line 1308, in callHandlers
    hdlr.handle(record)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.3.12
62.win-x86_64\lib\logging\__init__.py", line 748, in handle
    self.emit(record)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\User\lib\site-packages\astr
opy\logger.py", line 339, in _stream_formatter
    color_print(record.levelname, 'red', end='')
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\User\lib\site-packages\astr
opy\utils\console.py", line 230, in color_print
    if isatty(file) and USE_COLOR():
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\User\lib\site-packages\astr
opy\config\configuration.py", line 336, in __call__
    sec = get_config(self.module)
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\User\lib\site-packages\astr
opy\config\configuration.py", line 402, in get_config
    from ..utils import find_current_module
SystemError: Parent module 'astropy' not loaded, cannot perform relative import

Original exception was:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Omer\AppData\Local\Enthought\Canopy\User\lib\site-packages\astr
opy\__init__.py", line 136, in <module>
    from .utils import _compiler
ImportError: DLL load failed: %1 is not a valid Win32 application.
>>>

谁能帮我正确设置它?

4

1 回答 1

1

看起来您正在使用 Enthought Canopy?尝试安装 Anaconda Python Distribution ( https://store.continuum.io/cshop/anaconda/ ),因为它默认包含 Astropy。

于 2013-08-26T12:30:28.250 回答