py文件转可执行文件

使用Python官方提供的pyinstaller库。

pip3 install pyinstaller
pyinstaller -F nameofpy (-n nameofoutput)

使用示例
在hello.py所在目录下执行pyinstaller -F hello.py会在目录中产生dist文件夹,下有名为hello的可执行文件(不指定输出名时默认为py文件前缀)。
当然也可以执行pyinstaller -F hello.py -n hello1,会在目录中产生dist文件夹,下有名为hello1的可执行文件。
使用方式:python3 hello.py argu1 argu2等同于./hello argu1 argu2

posted @ 2023-03-21 15:27  心比天高xzh  阅读(32)  评论(0)    收藏  举报