程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python executable Exe generation

編輯:Python

Tools :py2exe

  • download ( To be and python Versions, ):FrontPage - py2exe.org

take pip Copy installation statements locally cmd in , open cmd, Input  

pip install py2exe -i https://pypi.tuna.tsinghua.edu.cn/simple/

Designated here pip The source is Tsinghua , Otherwise, the network speed will be too slow, resulting in timeout .

notes :1) Others pip Source :

Alibaba cloud http://mirrors.aliyun.com/pypi/simple/
University of science and technology of China https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
douban http://pypi.doubanio.com/simple/
Tsinghua University https://pypi.tuna.tsinghua.edu.cn/simple/
2) Another solution to timeout ( But it may not solve ):

pip install --default-timeout=1000  py2exe

  • cmd Enter the specified python Run in directory python+ Test code file ( This step can also be omitted , In order to ensure that the program can run correctly )

python  XXX.py

  • python A new one is added to the compiler setup.py file , Put it in the same directory as the code file to be run .setup.py Fill in the following contents in the document :
from distutils.core import setup
import py2exe
setup(console=['XXX.py'])

  • stay cmd Execute the following code in python setup.py py2exe

Just now setup.py Generate a... From the local file directory dist Folder , After entering, you will find the to be generated XXX.exe Execution procedure . 


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved