日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

python转成exe_将python程序转换成exe程序

發(fā)布時間:2025/3/20 python 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python转成exe_将python程序转换成exe程序 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

將python程序轉(zhuǎn)換成exe.

一、 先安裝python

2、安裝下載包,一路next。

3、為計算機添加安裝目錄搭到環(huán)境變量,如圖把python的安裝目錄添加到pth系統(tǒng)變量中即

可。(D:\\python32 是python的安裝路徑)

4、測試python安裝是否成功,cmd打開命令行輸入 python 命令,如下圖即成功了

6、直接解壓安裝到python的安裝目錄即可,C:\Python27\pyinstaller (pyinstaller 就是解壓后的目錄

7、進(jìn)入到安裝pyinstaller的目錄,新建一個存放py文件的目錄,在新建的目錄里放置我們的py程序

8、C:\Python27\PyInstaller-3.1.1

9、 轉(zhuǎn)換成exe.

在命令行執(zhí)行:python Makespec.py --console --onefile net\deploy_web.py

也許你會出現(xiàn)以下錯誤,也許不會,不報錯直接第9步

報錯:Configfile is missing or unreadable. Please run Configure.py before building

10、解決方法:

在命令行執(zhí)行:Configure.py

報錯:Python 2.6+ on Windows support needs pywin32,Please install http://sourceforge.net/projects/pywin32/

如果Python版本太低,則安裝最新版本的 pywin32-217.win32-py2.7.exe,下載地址:http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/

無錯誤時候,繼續(xù)執(zhí)行上 第9步

關(guān)于-F 參數(shù)解釋:

-F, --onefile

create a single file deployment

-D, --onedir

create a single directory deployment (default)

-o DIR, --out=DIR

create the spec file in directory. If not specified, and the current directory is Installer’s root directory, an output subdirectory will be created. Otherwise the current directory is used.

-n NAME, --name=NAME

optional name to assign to the project (from which the spec file name is generated). If omitted, the basename of the (first) script is used.

11、成功后生成一個和py腳本同名的目錄(deploy_web),在dict目錄下就生成一個.exe 程序。

12、執(zhí)行完.exe程序后生成一個txt文件,里面就是想要的信息、

總結(jié)

以上是生活随笔為你收集整理的python转成exe_将python程序转换成exe程序的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。