-
[Python] pyinstaller 실행파일 생성Engineering WIKI/Python 2021. 2. 21. 19:04
# test.py import datetime if __name__ == "__main__" : print("Start.") cur_time = datetime.datetime.now() print("Current time : %s" % cur_time) print("End.")
pyinstaller 설치
- pip install pyinstaller
exe 파일 만들기
- test.py가 있는 디렉토리로 이동하여, pyinstaller 명령어를 입력해줍니다.
- 참고로 --onefile 이라는 옵션을 넣어주면, 하나의 실행파일로 생성이 됩니다. (참고로, --noconsole 옵션을 넣어주면 콘솔창이 뜨지 않고 실행이 됩니다.)
- 명령어를 실행하면, 이와같이 dist, build 등 여러개의 파일이 생성됩니다.
- dist 폴더로 들어가보면, 아래와 같이 실행파일(test.exe)이 생성된것을 확인 할 수 있습니다.
- pyinstaller --onefile test.py
- 실행파일에 이미지 넣기
- pyinstaller --icon=test.ico --onefile test.py
'Engineering WIKI > Python' 카테고리의 다른 글
Class Advanced (0) 2022.04.06 [Python] itertools 완전탐색 (0) 2022.03.06 [Python] FastAPI 사용법 (0) 2021.04.13 [Python] One-line Tree in Python (0) 2021.02.21 Pandas 텍스트(txt) 파일 불러오기 및 저장하기 (0) 2021.02.03 [Python] 소요시간 측정방법 (0) 2020.12.09 [Python] Coding Test Tip (0) 2020.12.09 [Python] zip(*iterable) (0) 2020.11.11