导入aplpy报错:无法从astropy.config.configuration导入update_default_config
解决APLpy导入时的ImportError问题
这个错误是因为APLpy版本与当前安装的Astropy版本不兼容——旧版APLpy依赖的update_default_config函数,在新版Astropy中已从astropy.config.configuration模块移除。
解决方法
方法1:降级Astropy到兼容版本
APLpy 2.x系列兼容Astropy 4.x版本,执行以下命令降级:
- 使用pip:
pip install astropy==4.3.1
- 使用conda:
conda install astropy=4.3.1
方法2:安装APLpy的最新开发版
官方稳定版的APLpy可能未适配新版Astropy,直接从GitHub安装开发版可解决兼容问题:
pip install git+https://github.com/aplpy/aplpy.git
方法3:使用conda-forge的APLpy包
conda-forge源的APLpy通常已更新适配新Astropy,执行:
conda install -c conda-forge aplpy
内容的提问来源于stack exchange,提问作者laklak
相关产品推荐
相关产品推荐

