서버/MAC
[python] py2exe와 py2app을 통한 Windows/OS X용 실행파일 만들기
유키공
2017. 12. 28. 14:30
py2exe와 py2app 둘 다 distutils의 확장이기 때문에 다음과 같이 함께 사용할 수도 있습니다.
- setup.py
# -*- coding: utf-8 -*-
from setuptools import setup
import sys
if sys.platform == "win32":
# python setup.py py2exe
import py2exe
platform_options = {
"windows": [{
"script": "run.py",
"icon_resources": [(1, "window_icon.ico")],
"dest_base": "dodo"
}],
"zipfile": None,
"setup_requires": ["py2exe"],
"options": {
"py2exe": {
"includes": ["PySide.QtCore",
"PySide.QtGui",
"PySide.QtWebKit",
"PySide.QtNetwork",
"PySide.QtXml"],
"dll_excludes": ["w9xpopen.exe",
"msvcr71.dll",
"MSVCP90.dll"],
"compressed": True
}
}
}
elif sys.platform == "darwin":
# python setup.py py2app
platform_options = {
"setup_requires": ["py2app"],
"app": ["run.py"],
"options": {
"py2app": {
"argv_emulation": True,
"includes": ["PySide.QtCore",
"PySide.QtGui",
"PySide.QtWebKit",
"PySide.QtNetwork",
"PySide.QtXml"],
"iconfile": "window_icon.icns"
}
}
}
else:
# python setup.py install
platform_options = {
"scripts": ["run.py"]
}
setup(name="test_py2xxx",
description="py2xxx test application",
version="0.0.1",
**platform_options)