1


我正在尝试在 Windows 7 CPython 2.7.5 下运行 Astropy。
我从PyPi上可用的二进制文件进行了全新安装,但是当我尝试导入时,我得到了一个SystemError: Parent module 'astropy' not loaded, cannot perform relative import
但是,如果我再次尝试导入它,错误将变为ImportError与系统权限相关的已知问题 Astropy Known Issues

问题是我使用管理员帐户安装了系统范围内的所有内容。关于如何进行的任何建议?


在这里你可以看到完整的引用。

Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] Type "copyright", "credits" or "license" for more information.

IPython 1.1.0 -- An enhanced Interactive Python. ?         -> Introduction and overview of IPython's features. %quickref -> Quick reference. help      -> Python's own help system. object?   -> Details about 'object', use 'object??' for extra details. Using matplotlib backend: TkAgg

In [1]: import astropy Custom TB Handler failed, unregistering
--------------------------------------------------------------------------- SystemError                               Traceback (most recent call last) c:\python27\lib\site-packages\astropy\logger.py in ipy_exc_handler(ipyshell, ety pe, evalue, tb, tb_offset)
    270             def ipy_exc_handler(ipyshell, etype, evalue, tb, tb_offset=N one):
    271                 # First use our excepthook
--> 272                 self._excepthook(etype, evalue, tb)
    273
    274                 # Now also do IPython's traceback

c:\python27\lib\site-packages\astropy\logger.py in _excepthook(self, etype, valu e, traceback)
    220             self.error(message, extra={'origin': mod.__name__})
    221         else:
--> 222             self.error(message)
    223         self._excepthook_orig(etype, value, traceback)
    224

C:\Python27\lib\logging\__init__.pyc in error(self, msg, *args,
**kwargs)    1173         """    1174         if self.isEnabledFor(ERROR):
-> 1175             self._log(ERROR, msg, args, **kwargs)    1176    1177     def exception(self, msg, *args, **kwargs):

C:\Python27\lib\logging\__init__.pyc in _log(self, level, msg, args, exc_info, e xtra)    1266                 exc_info = sys.exc_info()    1267         record = self.makeRecord(self.name, level, fn, lno, msg, args, e xc_info, func, extra)
-> 1268         self.handle(record)    1269    1270     def handle(self, record):

C:\Python27\lib\logging\__init__.pyc in handle(self, record)    1276   """    1277         if (not self.disabled) and self.filter(record):
-> 1278             self.callHandlers(record)    1279    1280     def addHandler(self, hdlr):

C:\Python27\lib\logging\__init__.pyc in callHandlers(self, record)    1316                 found = found + 1    1317                 if record.levelno >= hdlr.level:
-> 1318                     hdlr.handle(record)    1319             if not c.propagate:    1320                 c = None    #break out

C:\Python27\lib\logging\__init__.pyc in handle(self, record)
    747             self.acquire()
    748             try:
--> 749                 self.emit(record)
    750             finally:
    751                 self.release()

c:\python27\lib\site-packages\astropy\logger.py in
_stream_formatter(self, recor d)
    337             color_print(record.levelname, 'brown', end='')
    338         else:
--> 339             color_print(record.levelname, 'red', end='')
    340         print(": {0} [{1:s}]".format(record.msg, record.origin))
    341

c:\python27\lib\site-packages\astropy\utils\console.py in color_print(*args, **k wargs)
    228
    229     write = file.write
--> 230     if isatty(file) and USE_COLOR():
    231         for i in xrange(0, len(args), 2):
    232             msg = args[i]

c:\python27\lib\site-packages\astropy\config\configuration.py in
__call__(self)
    334
    335         #get the value from the relevant `configobj.ConfigObj` object
--> 336         sec = get_config(self.module)
    337         if self.name not in sec:
    338             self.set(self.defaultvalue)

c:\python27\lib\site-packages\astropy\config\configuration.py in get_config(pack ageormod, reload)
    400
    401     from .paths import get_config_dir
--> 402     from ..utils import find_current_module
    403
    404     if packageormod is None:

SystemError: Parent module 'astropy' not loaded, cannot perform relative import The original exception:

In [2]: import astropy
--------------------------------------------------------------------------- ImportError                               Traceback (most recent call last) <ipython-input-2-d192094ef7da> in <module>()
----> 1 import astropy

c:\python27\lib\site-packages\astropy\__init__.py in <module>()
    125 if not _ASTROPY_SETUP_:
    126     from .logger import _init_log
--> 127     from . import config
    128
    129     import os

ImportError: cannot import name config

In [3]:


更多信息:这与此处
描述的问题类似,但我不想使用 Canopy 或 Anaconda。

4

0 回答 0