利用pyinstaller打包.py文件,将python的脚本部署到其他没有安装python环境的电脑,同时可以传参数(mac os)
安装
·pip3 install pyinstaller
切换到.py文件路径,执行:pyinstaller -F **.py
执行成功后./dist路径下生成可执行文件,将dist文件夹压缩即可
将压缩包发给没有python环境的mac(mac生成的可执行文件,必须在mac下执行,windows需要在windows环境相生成.exe文件)
解压后切换到./dist路径
cd ./dist
./hack “参数” “参数” “参数”
参数放在后面即可,在脚本中用sys.argv[n]接收参数