- 파이썬 script 소스 코드를 *.exe 파일로 변환하는 방법
//-------------------------------------
- pyinstaller 설치
pip install pyinstaller
- 실행 파일로 만들기
pyinstaller --onefile hello.py
- 만들어진 hello.exe 실행에 3초 정도 걸림
- 생성된 실행파일이 다른 모듈 의존도가 낮음
> dumpbin /dependents hello.exe
KERNEL32.dll
ADVAPI32.dll
//-------------------------------------
pi2exe
http://www.py2exe.org/
https://github.com/py2exe/py2exe
- py2exe 설치
pip install py2exe
- 스크립트 실행 파일로 만들기
https://www.py2exe.org/index.cgi/Tutorial
- hello.py
print "Hello World!"
- setup.py 파일 생성
from distutils.core import setup
import py2exe, sys, os
sys.argv.append("py2exe")
setup(
options={"py2exe": {"bundle_files": 1, "compressed": True}},
windows=[{"script": "hello.py"}],
zipfile=None,
)
- exe 만들기
python setup.py py2exe
- 만들어진 hello.exe 실행에 2초 정도 걸림
- 생성된 실행파일이 다른 모듈 의존도가 높음
> dumpbin /dependents hello.exe
USER32.dll
SHELL32.dll
KERNEL32.dll
VCRUNTIME140.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
//-------------------------------------
https://github.com/python/cpython
//-------------------------------------
https://stackoverflow.com/questions/5458048/how-can-i-make-a-python-script-standalone-executable-to-run-without-any-dependen
'Code' 카테고리의 다른 글
Python GUI (0) | 2022.04.21 |
---|---|
python 가상 환경 제어 (0) | 2022.04.21 |
python 스크립트를 실행파일로 만들기 (0) | 2022.04.21 |
git 에러 fatal: unsafe repository owned by someone else 해결 방법 (0) | 2022.04.15 |
Visual studio 시작시 보이는 스케일 관련 경고 메시지 처리 방법 (0) | 2022.03.13 |
비주얼 스튜디오 프로젝트 삭제할 임시파일 리스트 (0) | 2022.03.11 |
댓글을 달아 주세요