2.python打包


python打包

打包为文件夹的形式

pip install pyinstaller

mac 需要使用sudo执行
sudo pyinstaller hello.py 

打包为单个文件的形式

pip install pyinstaller

mac 需要使用sudo执行
sudo pyinstaller hello.py 

python执行脚本

cat  hello.py
#!/usr/bin/python3.8  # 声明解释器的绝对路径
if __name__ == '__main__':
    print('hello')
	
cat  hello.py
#!/usr/bin/env python3.8  # 在环境变量里里找python3.8
if __name__ == '__main__':
    print('hello')