【问题标题】:Astropy Deprecation WarningAstropy 弃用警告
【发布时间】:2014-07-22 03:32:37
【问题描述】:

我为 python 2.7 安装了 Anaconda 发行版(一切正常),然后我在 SunPy install 之后安装了 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:文件“C:\Users\nandhos.astropy\config\astropy.cfg”的 [io.fits] 部分中的配置参数“enabled_record_valued_keyword_cards”已弃用。请改用 [fits] 部分中的“enable_record_valued_keyword_cards”。 [astropy.config.configuration]

显然,一切正常,只是我想知道为什么会出现此消息。如何使用“enable_record_valued_keyword_cards”部分适合其他配置?

【问题讨论】:

    标签: python astropy


    【解决方案1】:

    消除警告的最简单方法是简单地删除 ~/.astropy/config/astropy.cfg 文件,如果您之前没有编辑过它。这应该在 astropy 的后续版本中得到修复。

    【讨论】:

    • 仅此而已?我删除了文件 astropy.cfg 并留下了 astropy.0.4.cfg 和 astropy.log。我运行,警告消失并再次出现文件 astropy.cfg,但没有警告。谢谢
    • 需要明确的是,Astropy 配置系统在 v0.4 中进行了大修,因此如果您有旧的配置文件,则会出现类似这样的消息。见:docs.astropy.org/en/stable/config/…
    • 同时,如果您没有有一个过期的 astropy.cfg 并且您仍然看到这样的消息,那是因为一个微妙的错误可能发生:github.com/astropy/astropy/issues/2772
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-11
    • 2021-07-12
    • 2017-08-22
    • 2011-09-29
    • 2018-09-08
    相关资源
    最近更新 更多