ImportError:无法从'astropy.utils'导入名称'_compiler'

问题描述 投票:0回答:1

我目前正在使用其中使用astropy的python程序包,但遇到一个错误,我自己在使用astropy时从未收到此错误:

File "<ipython-input-14-fe241c5d4a10>", line 1, in <module>
runfile('/Users/colbyostberg/GoogleDrive/Python/Python37/Pandexo_Runner.py', wdir='/Users/colbyostberg/GoogleDrive/Python/Python37')

File "/Users/colbyostberg/anaconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile
execfile(filename, namespace)

File "/Users/colbyostberg/anaconda3/lib/python3.7/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "/Users/colbyostberg/GoogleDrive/Python/Python37/Pandexo_Runner.py", line 9, in <module>
import pandexo.engine.justdoit as jdi # THIS IS THE HOLY GRAIL OF PANDEXO

File "/Users/colbyostberg/anaconda3/lib/python3.7/site-packages/pandexo/engine/justdoit.py", line 2, in <module>
from pandeia.engine.instrument_factory import InstrumentFactory

File "/Users/colbyostberg/anaconda3/lib/python3.7/site-packages/pandeia/engine/instrument_factory.py", line 5, in <module>
from .utils import recursive_subclasses, merge_data

File "/Users/colbyostberg/anaconda3/lib/python3.7/site-packages/pandeia/engine/utils.py", line 8, in <module>
import pysynphot as psyn

File "/Users/colbyostberg/anaconda3/lib/python3.7/site-packages/pysynphot/__init__.py", line 24, in <module>
from .spectrum import BlackBody, GaussianSource, FlatSpectrum  # noqa

File "/Users/colbyostberg/anaconda3/lib/python3.7/site-packages/pysynphot/spectrum.py", line 15, in <module>
from astropy.io import fits as pyfits

File "/Users/colbyostberg/GoogleDrive/Python/Python37/astropy/__init__.py", line 289, in <module>
_initialize_astropy()

File "/Users/colbyostberg/GoogleDrive/Python/Python37/astropy/__init__.py", line 181, in _initialize_astropy
from .utils import _compiler

ImportError: cannot import name '_compiler' from 'astropy.utils' (/Users/colbyostberg/GoogleDrive/Python/Python37/astropy/utils/__init__.py)

我已尝试以多种方式卸载并重新安装astropy,但这没有帮助,并且我确保我的PYTHONPATH正确指向其中包含numpy的目录,但没有任何效果。

请帮助。

python-3.x importerror astropy
1个回答
0
投票
我的问题下面的第一条评论是正确的。我混合了我的PYTHONPATH,它指向错误的目录。我决定用蛮力解决此问题,并重新安装了所有蟒蛇,并删除了我之前设置的PYTHONPATH。然后在重新安装后一切都很好,而且我再也不会碰到PYTHONPATH了:)
© www.soinside.com 2019 - 2024. All rights reserved.