「Python py2exe」の版間の差分
ナビゲーションに移動
検索に移動
(ページの作成:「==Python py2exe == http://www.py2exe.org/ ===概要=== *PythonスクリプトをWindowsの実行可能プログラムにコンバートすDistutils エクステン…」) |
|||
12行目: | 12行目: | ||
print "Hello Py2Exe" | print "Hello Py2Exe" | ||
=====実行 ===== | =====実行 ===== | ||
− | C:\work | + | C:\work>python hello.py |
Hello Py2Exe | Hello Py2Exe | ||
34行目: | 34行目: | ||
*** searching for required modules *** | *** searching for required modules *** | ||
*** parsing results *** | *** parsing results *** | ||
− | creating python loader for extension 'select' (C:\Python26\DLLs\select.pyd - | + | creating python loader for extension 'select' (C:\Python26\DLLs\select.pyd -> select.pyd) |
− | creating python loader for extension 'unicodedata' (C:\Python26\DLLs\unicodedata.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 - | + | creating python loader for extension 'bz2' (C:\Python26\DLLs\bz2.pyd -> bz2.pyd) |
*** finding dlls needed *** | *** finding dlls needed *** | ||
*** create binaries *** | *** create binaries *** | ||
45行目: | 45行目: | ||
(略) | (略) | ||
: | : | ||
− | copying C:\Python26\DLLs\unicodedata.pyd - | + | copying C:\Python26\DLLs\unicodedata.pyd -> C:\work\dist |
*** copy dlls *** | *** copy dlls *** | ||
− | copying C:\WINDOWS\system32\python26.dll - | + | 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:\Python26\w9xpopen.exe - | + | copying C:\Python26\w9xpopen.exe -> C:\work\dist |
− | copying C:\Python26\lib\site-packages\py2exe\run.exe - | + | copying C:\Python26\lib\site-packages\py2exe\run.exe -> C:\work\dist\hello.exe |
*** binary dependencies *** | *** binary dependencies *** |
2020年2月15日 (土) 08:05時点における版
目次
Python py2exe
概要
- PythonスクリプトをWindowsの実行可能プログラムにコンバートすDistutils エクステンション
- Pythonのインストールがなくても実行できるようにする
サンプルをつくる
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 矢木浩人