dist文件夾中找到我懷疑你的祖母使用在這種情況下窗戶我會推薦使用py2exe。 這裏可能都是你需要的... 1)。創建以下腳本並將其最後一行修改爲實際腳本的名稱(請參閱其最後一行)
#execmaker.py would be the name of this file
#stable version
from distutils.core import setup
import py2exe
includes = []
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'Tkinter']
packages = []
dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
'tk84.dll']
setup(
options = {"py2exe": {"compressed": 2,
"optimize": 2,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 3,#dont bundle else unstable
"dist_dir": "dist",
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},
windows=['My_Script.py'] #this is the name of your actual script
)
2)。那麼你可以去到這個腳本和你實際的腳本駐留通過CMD的目錄,然後鍵入
python execmaker.py py2exe
您現在應該有一個工作的可執行文件。現在你可以雙擊可執行文件,你的腳本就會運行。哦,是的,如果你有問題請遵循這個傢伙的指示......他很好!
http://www.blog.pythonlibrary.org/2010/07/31/a-py2exe-tutorial-build-a-binary-series/
一切正常!另外,出於某種原因,當我將'execmaker.py py2exe'放入cmd時,它會運行。出於某種原因,它不會將'python'識別爲函數。但它的工作。它確實創建了一堆文件。任何方式讓它構建應用程序作爲單個文件? –
我很高興它做到了。它不認識python的原因是因爲你需要做這個小竅門,涉及將python添加到此處詳細介紹的路徑中... http://stackoverflow.com/questions/3701646/how-to-add-to-the- PYTHONPATH,在窗口-7。如果您更改了bundle_files參數,它應該會生成更加整潔的最終產品...查看我發佈的鏈接。 –