关于Python的打包与编译

1、nuitka 编译成一个so文件

nuitka3 --module --include-module=target_file_or_dir target_file_or_dir 

2、compileall 编译成pyc

python3 -m compileall -b <dir>
# 删除相关的py文件
find <dir> -name '*.py' -type f -print -exec rm {} \;

3、bdist_wheel 打包 whl文件

#需要先编写 setup.py文件
python3 setup.py bdist_wheel 
# 安装打包的whl文件
pip install xxx-1.0.1-py3-none-any.whl
posted @ 2023-10-20 12:27  #LittleBabe  阅读(120)  评论(0)    收藏  举报