亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2599 | 回復(fù): 0
打印 上一主題 下一主題

py2exe用法 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2006-04-12 11:45 |只看該作者 |倒序瀏覽

How to use py2exe - the basics
[url=javascript:void window.open('http://www.pharscape.org/index2.php?option=com_content&task=view&id=33&Itemid=51&pop=1&page=0', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');]

[/url]
[url=javascript:void window.open('http://www.pharscape.org/index2.php?option=com_content&task=emailform&id=33', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=400,height=250,directories=no,location=no');]

[/url]

A lot of new Windows based Python coders think they don't have a real program until their code has been transformed into an executable with it's magical .exe file extension.
Most python programs never get that sprinkling of fairy dust.
Anyway, this is how you do it...
This is a step-by-step guide to making python programs standalone executables.:

1. Download and install py2exe from the
py2exe website
(make sure you download the right version!)
2. Create a directory on you hardisk called mycode ... - Right click on the Windows Desktop and select New .. Folder and name it "mycode"
3. Double click the mycode folder to open it
4. Right click in the folder and select New.. Text Document, name it "hello.txt"
5. Right click in the folder and select New.. Text Document, name it "setup.txt"
6. Double click hello.txt to open it in Notepad
7. Copy the following text into the file and save it:
#Start here
print "Hello py2exe"
raw_input("Press any key to finish")
#End here
8. Double click the setup.txt and copy in the following code (and save the file):
#Start here
from distutils.core import setup
import py2exe
setup(console = ["hello.py"])
#End here
9. Right click on the hello.txt file and rename it to hello.py (ignore the warning)
10. Right click on the setup.txt file and rename it to setup.py (ignore the warning)
11. Start a command console (also called a DOS box) (It is found in the START-> Accessories menu on Windows XP). Alternatiively -start a command console by clicking Start -> Run...  and type cmd in the dialog.
12. In the console type
cd desktop
cd mycode
13. Type
start hello.py
14. If you entered the code correctly then a new console is created which asks you to press a key
15. The program works so now we can also use py2exe to make a standalone program. Type
start setup.py py2exe
16. If there are no errors in the setup.py file then py2exe will run. It creates a new sub-directory called dist. Type
cd dist
17. There should be a file called hello.exe Type:
hello
18. You have finished.

Remember - every file in the dist directory is needed for your hello.exe to run properly. (Zip all the files together and send it to your friends).

Py2exe - the littlest script?
[url=javascript:void window.open('http://www.pharscape.org/index2.php?option=com_content&task=view&id=18&Itemid=51&pop=1&page=0', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');]

[/url]
[url=javascript:void window.open('http://www.pharscape.org/index2.php?option=com_content&task=emailform&id=18', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=400,height=250,directories=no,location=no');]

[/url]
Py2exe
is as easy or as complex to use as you wish to make it. The following code demonstrates a minimal script.
For a console application (one that allows input and output using the print and raw_input function):
from distutils.core import setup
import py2exe
import sys
sys.argv.append("py2exe")
setup(console = [{"script": 'prog.py'}])
If you want a "pure" windows application perhaps using Tkinter or wxPython:
from distutils.core import setup
import py2exe
import sys
sys.argv.append("py2exe")
setup(windows = [{"script": 'prog.py'}])
Copy either of these scripts to the directory containing the program you want to "compile", saving it as "setup.py". You will need to replace the name "prog.py" with the name of your script.
To compile the script just run
python setup.py


本文來自ChinaUnix博客,如果查看原文請點:http://blog.chinaunix.net/u/17118/showart_98641.html
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP