2013-08-26 81 views
-1

我有Windows 8(可惜我很幸運,但支持非常糟糕的Linux的筆記本電腦,嘗試了幾種發行版。)。我安裝了Python 2.7,也可以導入scipy和numpy。我已經從他們的站點安裝了可執行文件的astropy,但是當我嘗試導入它時,我會看到下面的錯誤消息。當在Windows 8中導入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. 
>>> 

誰能幫我正確設置它?

+0

您是否安裝了32位或64位Python? – Blender

+1

您應該將錯誤信息直接放入問題中,否則一旦鏈接的文件被刪除,問題將無法使用。 – flornquake

+0

我已經安裝了64位Python – Ohm

回答

1

它看起來像你使用Enthought Canopy?嘗試安裝Anaconda Python Distribution(https://store.continuum.io/cshop/anaconda/),因爲它默認包含Astropy。

+0

蟒蛇的免費版本是否也包含Astropy? – Ohm

+0

是的,事實上,自從我寫了上面的答案之後,Enthought Canopy的免費版本現在還包含Astropy! – astrofrog