linux (centos 7.5) 下使用python 2.7 打包

1、安装pip

安装pip2 20.0版本

curl "https://bootstrap.pypa.io/pip/2.7/get-pip.py" -o "get-pip.py"
python get-pip.py

2、安装 pyinstaller 
python 安装最好的pyintaller 版本为3.4
pip install pyinstaller==3.4

3、打包

pyinstaller -F spy.py

4、信创 鲲鹏920下安装:

1、修改源,安装依赖:

指定清华源:
pip install psutil
-i https://pypi.tuna.tsinghua.edu.cn/simple 如果是转发后的源,对应版本是 python 2.7 ,后面加上版本号的限定:
pip install
--upgrade pip -i http://xxxxxxxx:9337/tsinghua/simple --trusted-host xx.xx.xx.xxx pip install psutil -i http://xxxxxxxx:9337/tsinghua/simple --trusted-host xx.xx.xx.xxx

2、通过 cx_Freeze 打包

 

安装包:
pip install cx_Freeze==5.1.1 -i http://10.xx.xx.xxx:9337/tsinghua/simple --trusted-host 10.xx.xx.xxx

 创建打包文件 setup.py 

from cx_Freeze import setup, Executable

setup(
    name='spyApp',
    version='0.2',
    description='equip spy',
    executables=[Executable('spy.py', base='spyApp')]
)

 放到同一个文件夹下:

执行命令:python setup.py build

在build下面找到打包文件

测试: 处理权限问题:  chmod +x spy

 

posted @ 2022-09-08 17:52  leolzi  阅读(104)  评论(0)    收藏  举报