Python程序打包成exe报错

WARNING: AstropyDeprecationWarning: The private astropy._erfa module has been made into its own package, pyerfa, which is a dependency of astropy and can be imported directly using "import erfa" [astropy._erfa]
3042 WARNING: AstropyDeprecationWarning: The private astropy._erfa module has been made into its own package, pyerfa, which is a dependency of astropy and can be imported directly using "import erfa"

这是咋回事呢?

这个报错说的其实很明显了:
这个警告消息是来自 Astropy(一个常用的天文学 Python 库)的警告信息。该警告是由于 Astropy 在将私有模块 _erfa 提取为独立包 pyerfa 后引发的。

由于此更改,Astropy 建议直接使用 import erfa 来导入 pyerfa,而不是使用原先的 import astropy._erfa。因此,你可以尝试在你的代码中将导入语句替换为 import erfa 来避免这个警告:

import erfa

这样做后,你应该可以避免显示这个警告信息。请注意,如果你的代码有其他对 _erfa 的相关引用,你可能需要相应地更新它们以使用 erfa 模块。

如果还不会,可以再联系,我经常打包exe