# 编译成pyc文件方法一
python -m py_compile file.py
# 编译成pyc方法二
pyinstaller -D file.py
__pycache__ 目录下获得pyc文件
本文介绍了两种将Python代码编译为pyc文件的方法:使用python-mpy_compilefile.py脚本和通过PyInstaller工具。pyc文件在__pycache__目录下生成,有助于提高代码的加载速度。
# 编译成pyc文件方法一
python -m py_compile file.py
# 编译成pyc方法二
pyinstaller -D file.py
__pycache__ 目录下获得pyc文件
2722
4980

被折叠的 条评论
为什么被折叠?