Python 스크립트파일을 Exe로 변경

Install py2exe

> pip install py2exe

실행 스크립트

#execute_test.py
print 'HelloWorld'

Setup.py 스크립트

#setup.py
from distutils.core import setup
import py2exe, sys, os

sys.argv.append('py2exe')

options = {
    "bundle_files": 1,                    # create singlefile exe
    "compressed"  : 1,                    # compress the library archive
    "excludes"    : ["w9xpopen.exe"]    # we don't need this
}

setup(
    options = {'py2exe' : options},
    windows = [{'script': "merge_swf_helper.py"}],
    zipfile = None,
)

Cmd 창에서 빌드 명령 실행

> python setup.py install

결과 확인

명령을 실행한 폴더의 dist 디렉토리에 들어가면 생성된 exe 파일을 볼 수 있다.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s