Astropy 废弃警告

0 投票
1 回答
1207 浏览
提问于 2025-04-18 14:01

我安装了Anaconda这个Python 2.7的版本(运行得很好),然后我按照SunPy的安装指南安装了SunPy。

要安装SunPy的额外依赖项,可以运行:

conda update astropy
pip install suds

要安装,可以运行:

pip install sunpy

但是当我运行类似这样的命令时:

from astropy.io import fits
file = fits.open("file.fits")
file = file[0].data

我收到了一个警告,这个警告在我安装SunPy和更新Astropy之前是没有的。

警告内容是:AstropyDeprecationWarning: 配置参数'enabled_record_valued_keyword_cards'在文件'C:\Users\nandhos.astropy\config\astropy.cfg'的[io.fits]部分中已被弃用。请改用[fits]部分中的'enable_record_valued_keyword_cards'。 [astropy.config.configuration]

显然,一切运行正常,只是我想知道为什么会出现这个消息。我该如何在fits部分使用“enable_record_valued_keyword_cards”来替代其他配置呢?

1 个回答

2

最简单的解决这个警告的方法就是直接删除 ~/.astropy/config/astropy.cfg 这个文件,如果你之前没有对它进行过修改的话。之后的 astropy 版本应该会修复这个问题。

撰写回答