首页 > 解决方案 > Python compileall:.pyc 文件中的幻数错误

问题描述

我正在编译一个类似的python脚本:

python3 -m compileall script.py

我正在使用python3.7 ,但如果有人在其他 python 版本中运行此脚本,则会出现此问题

RuntimeError: Bad magic number in .pyc file

有什么方法可以编译任何 python3 版本吗?或如何解决?

标签: python-3.xcompilation

解决方案


推荐阅读