我正在 google colab 上导入一些包 - 我在这些方面工作了一段时间,但是有一天,当我尝试导入 photutils 包(天文学家使用的一个包)时,我出现了这条消息:
TypeError Traceback (most recent call last)
<ipython-input-8-6005ccc011a4> in <module>
1 try:
----> 2 import photutils
3 import splusdata
26 frames
TypeError: __init__() got an unexpected keyword argument 'registry'
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
/usr/local/lib/python3.8/dist-packages/astropy/nddata/mixins/ndio.py in __init__(self, instance, cls)
53
54 def __init__(self, instance, cls):
---> 55 super().__init__(instance, cls, "read", registry=None)
56 # uses default global registry
57
TypeError: __init__() got an unexpected keyword argument 'registry'
我的导入代码是:
try:
import photutils
import splusdata
import astropy
from astropy.wcs import WCS
from astropy import units as u
from astropy.stats import sigma_clipped_stats
from astropy.coordinates import SkyCoord
from astropy.table import Table, vstack, hstack
from photutils.aperture import aperture_photometry, CircularAperture, CircularAnnulus, SkyCircularAperture, SkyCircularAnnulus
from photutils.utils import calc_total_error
import cmastro
except:
!pip install photutils
!pip install astropy
!pip install splusdata
!pip install cmastro
import photutils
import astropy
from photutils.utils import calc_total_error
from astropy.wcs import WCS
from astropy.stats import sigma_clipped_stats
from astropy import units as u
from astropy.coordinates import SkyCoord
from astropy.table import Table, vstack
from photutils.aperture import aperture_photometry, CircularAperture, CircularAnnulus, SkyCircularAperture, SkyCircularAnnulus
import cmastro
我尝试在那天运行我的导入代码,但它不再工作了。
解决方法是卸载 jupyter 并重新安装。
pip卸载jupyter pip 安装 jupyter
那就试试吧
jupyter 笔记本