「Python py2exe」の版間の差分
ナビゲーションに移動
検索に移動
1行目: | 1行目: | ||
− | ==Python py2exe == | + | ==[[Python py2exe]] == |
http://www.py2exe.org/ | http://www.py2exe.org/ | ||
===概要=== | ===概要=== | ||
− | * | + | *Pythonスクリプトを[[Windows]]の実行可能プログラムにコンバートすDistutils エクステンション |
− | * | + | *[[Python]]のインストールがなくても実行できるようにする |
===サンプルをつくる=== | ===サンプルをつくる=== | ||
*http://www.py2exe.org/index.cgi/Tutorial#Step1 | *http://www.py2exe.org/index.cgi/Tutorial#Step1 | ||
24行目: | 24行目: | ||
C:\work\python setup.py py2exe | C:\work\python setup.py py2exe | ||
− | C:\ | + | C:\[[Python]]26\lib\site-packages\py2exe\build_exe.py:16: DeprecationWarning: the sets module is deprecated |
import sets | import sets | ||
running py2exe | running py2exe | ||
34行目: | 34行目: | ||
*** searching for required modules *** | *** searching for required modules *** | ||
*** parsing results *** | *** parsing results *** | ||
− | creating python loader for extension 'select' (C:\ | + | creating python loader for extension 'select' (C:\[[Python]]26\DLLs\select.pyd -> select.pyd) |
− | creating python loader for extension 'unicodedata' (C:\ | + | creating python loader for extension 'unicodedata' (C:\[[Python]]26\DLLs\unicodedata.pyd -> unicodedata.pyd) |
− | creating python loader for extension 'bz2' (C:\ | + | creating python loader for extension 'bz2' (C:\[[Python]]26\DLLs\bz2.pyd -> bz2.pyd) |
*** finding dlls needed *** | *** finding dlls needed *** | ||
*** create binaries *** | *** create binaries *** | ||
*** byte compile python files *** | *** byte compile python files *** | ||
− | byte-compiling C:\ | + | byte-compiling C:\[[Python]]26\lib\StringIO.py to StringIO.pyc |
− | byte-compiling C:\ | + | byte-compiling C:\[[Python]]26\lib\UserDict.py to UserDict.pyc |
: | : | ||
(略) | (略) | ||
: | : | ||
− | copying C:\ | + | copying C:\[[Python]]26\DLLs\unicodedata.pyd -> C:\work\dist |
*** copy dlls *** | *** copy dlls *** | ||
copying C:\WINDOWS\system32\python26.dll -> C:\work\dist | copying C:\WINDOWS\system32\python26.dll -> C:\work\dist | ||
setting sys.winver for 'C:\work\dist\python26.dll' to 'py2exe' | setting sys.winver for 'C:\work\dist\python26.dll' to 'py2exe' | ||
− | copying C:\ | + | copying C:\[[Python]]26\w9xpopen.exe -> C:\work\dist |
− | copying C:\ | + | copying C:\[[Python]]26\lib\site-packages\py2exe\run.exe -> C:\work\dist\hello.exe |
*** binary dependencies *** | *** binary dependencies *** | ||
60行目: | 60行目: | ||
WSOCK32.dll - C:\WINDOWS\system32\WSOCK32.dll | WSOCK32.dll - C:\WINDOWS\system32\WSOCK32.dll | ||
− | + | USE[[R]]32.dll - C:\WINDOWS\system32\USE[[R]]32.dll | |
ADVAPI32.dll - C:\WINDOWS\system32\ADVAPI32.dll | ADVAPI32.dll - C:\WINDOWS\system32\ADVAPI32.dll | ||
SHELL32.dll - C:\WINDOWS\system32\SHELL32.dll | SHELL32.dll - C:\WINDOWS\system32\SHELL32.dll | ||
− | + | KE[[R]]NEL32.dll - C:\WINDOWS\system32\KE[[R]]NEL32.dll | |
====構成==== | ====構成==== |
2020年2月16日 (日) 04:31時点における最新版
目次
Python py2exe
概要
サンプルをつくる
Exeにしたいプログラム
hello.py
print "Hello Py2Exe"
実行
C:\work>python hello.py Hello Py2Exe
セットアップスクリプト
setup.py
from distutils.core import setup import py2exe setup(console=['hello.py'])
セットアップスクリプトの実行
C:\work\python setup.py py2exe C:\Python26\lib\site-packages\py2exe\build_exe.py:16: DeprecationWarning: the sets module is deprecated import sets running py2exe creating C:\work\build : (略) : creating C:\work\dist *** searching for required modules *** *** parsing results *** creating python loader for extension 'select' (C:\Python26\DLLs\select.pyd -> select.pyd) creating python loader for extension 'unicodedata' (C:\Python26\DLLs\unicodedata.pyd -> unicodedata.pyd) creating python loader for extension 'bz2' (C:\Python26\DLLs\bz2.pyd -> bz2.pyd) *** finding dlls needed *** *** create binaries *** *** byte compile python files *** byte-compiling C:\Python26\lib\StringIO.py to StringIO.pyc byte-compiling C:\Python26\lib\UserDict.py to UserDict.pyc : (略) : copying C:\Python26\DLLs\unicodedata.pyd -> C:\work\dist *** copy dlls *** copying C:\WINDOWS\system32\python26.dll -> C:\work\dist setting sys.winver for 'C:\work\dist\python26.dll' to 'py2exe' copying C:\Python26\w9xpopen.exe -> C:\work\dist copying C:\Python26\lib\site-packages\py2exe\run.exe -> C:\work\dist\hello.exe *** binary dependencies *** Your executable(s) also depend on these dlls which are not included, you may or may not need to distribute them. Make sure you have the license if you distribute any of them, and make sure you don't distribute files belonging to the operating system. WSOCK32.dll - C:\WINDOWS\system32\WSOCK32.dll USER32.dll - C:\WINDOWS\system32\USER32.dll ADVAPI32.dll - C:\WINDOWS\system32\ADVAPI32.dll SHELL32.dll - C:\WINDOWS\system32\SHELL32.dll KERNEL32.dll - C:\WINDOWS\system32\KERNEL32.dll
構成
C:\work ここで作業する
- dist、build ディレクトリが作成される
配布用
C:\work\dist に配布用パッケージが作成される
- exe 単体では動かない。
実行
© 2006 矢木浩人