使用pyinstaller将Python文件打包成linux可执行文件。

安装pip3:

 

sudo apt-get install python3-pip

更换pip3下载源:

 1 sudo su
 2 
 3 cd /root/
 4 
 5 mkdir .pip
 6 
 7 cd .pip
 8 
 9 touch pip.conf
10 
11 vi pip.conf

 

将以下内容写入到pip.conf中:

[global]

index-url = https://pypi.tuna.tsinghua.edu.cn/simple

[install]

trusted-host=pypi.tuna.tsinghua.edu.cn

退出pip.conf

回到需要打包的文件所在目录下,

安装pyinstaller:

pip3 install pyinstaller

打包:

pyinstaller -F 要打包的.py文件 -p /usr/local/lib/python3.5/dist-packages/

打包完成后,生成的可执行文件在文件夹dist下。

相关文章:

  • 2021-07-10
  • 2021-10-16
  • 2021-12-31
  • 2021-12-22
  • 2021-11-08
  • 2021-12-04
  • 2021-12-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
相关资源
相似解决方案