"Pyinstaller"의 두 판 사이의 차이
DB CAFE
66번째 줄: | 66번째 줄: | ||
※ ico 파일 외에도 icon이 리소스에 적용되어 있는 exe 파일을 사용해도 된다. | ※ ico 파일 외에도 icon이 리소스에 적용되어 있는 exe 파일을 사용해도 된다. | ||
저렇게 하면 빌드된 exe 파일의 리소스 영역에 아이콘의 이미지 저장 | 저렇게 하면 빌드된 exe 파일의 리소스 영역에 아이콘의 이미지 저장 | ||
+ | == maximum recursion error 발생시 == | ||
+ | |||
+ | https://stackoverflow.com/questions/38977929/pyinstaller-creating-exe-runtimeerror-maximum-recursion-depth-exceeded-while-ca | ||
+ | |||
+ | This worked for me | ||
+ | |||
+ | Run pyinstaller and stop it to generate the spec file : | ||
+ | |||
+ | pyinstaller filename.py | ||
+ | A file with .spec as extension should be generated | ||
+ | Now add the following lines to the beginning of the spec file : | ||
+ | |||
+ | import sys | ||
+ | sys.setrecursionlimit(5000) | ||
+ | Now run the spec file using : | ||
+ | |||
+ | pyinstaller filename.spec | ||
+ | |||
[[category:python]] | [[category:python]] |
2020년 4월 21일 (화) 08:33 판
thumb_up 추천메뉴 바로가기
- DBA { Oracle DBA 명령어 > DBA 초급 과정 > DBA 고급 과정 }
- 튜닝 { 오라클 튜닝 목록 }
- 모델링 { 데이터 모델링 가이드 }
목차
1 파이썬을 exe 파일로 배포 하기[편집]
2 pyinstaller parameter[편집]
usage: pyinstaller [-h] [-v] [-D] [-F] [--specpath DIR] [-n NAME]
[--add-data <SRC;DEST or SRC:DEST>]
[--add-binary <SRC;DEST or SRC:DEST>] [-p DIR]
[--hidden-import MODULENAME]
[--additional-hooks-dir HOOKSPATH]
[--runtime-hook RUNTIME_HOOKS] [--exclude-module EXCLUDES]
[--key KEY] [-d {all,imports,bootloader,noarchive}] [-s]
[--noupx] [--upx-exclude FILE] [-c] [-w]
[-i <FILE.ico or FILE.exe,ID or FILE.icns>]
[--version-file FILE] [-m <FILE or XML>] [-r RESOURCE]
[--uac-admin] [--uac-uiaccess] [--win-private-assemblies]
[--win-no-prefer-redirects]
[--osx-bundle-identifier BUNDLE_IDENTIFIER]
[--runtime-tmpdir PATH] [--bootloader-ignore-signals]
[--distpath DIR] [--workpath WORKPATH] [-y]
[--upx-dir UPX_DIR] [-a] [--clean] [--log-level LEVEL]
scriptname [scriptname ...]
2.1 1개 EXE파일에 묶어서 배포 하기[편집]
옵션 : -F (압축 방식으로 묶이기 때문에 실행 시 압축을 푸는 딜레이가 미세하게 발생한다.)
ex) pyinstaller.exe -F sample.py
sample.py 라는 파일이 sample.exe 파일 하나로 묶이게 된다.
2.2 exe 파일 실행 시 콘솔(도스창) 화면을 나타나지 않게 처리[편집]
총 세 가지 방법이 있는데 한 가지만 사용
ex) pyinstaller.exe --noconsole sample.py
ex) pyinstaller.exe -w sample.py
ex) pyinstaller.exe --windowed sample.py
2.3 관리자 권한으로 실행[편집]
ex) pyinstaller.exe --uac-admin sample.py
※ 해당 옵션은 exe 단일 파일로 묶는 -F 인자랑 같이 쓰면 적용 안됨
-F를 사용하지 않으면 파일이 여러개로 쪼개어 생성되겠지만 정작 메인 exe 파일은 관리자 권한 요청이 기본으로 적용
( 만약 빌드하고 싶은 파일이 x64 가 아닌 x86 이라면 굳이 pyinstaller 말고 py2exe 사용 )
2.4 빌드 파일에 아이콘을 적용하고 싶을 경우[편집]
ex) pyinstaller.exe --icon=icons\icon.ico sample.py
ex) pyinstaller.exe -i=icons\icon.ico sample.py
※ 위의 인자값은 icons 폴더 안에 있는 icon.ico 파일을 사용한다는 의미. 위 예제문의 경우 .py 파일과 같은 경로에 icons 폴더가 존재.(만약 완전 다른 경로라면 full path 적용).
※ ico 파일 외에도 icon이 리소스에 적용되어 있는 exe 파일을 사용해도 된다.
저렇게 하면 빌드된 exe 파일의 리소스 영역에 아이콘의 이미지 저장
3 maximum recursion error 발생시[편집]
This worked for me
Run pyinstaller and stop it to generate the spec file :
pyinstaller filename.py A file with .spec as extension should be generated Now add the following lines to the beginning of the spec file :
import sys sys.setrecursionlimit(5000) Now run the spec file using :
pyinstaller filename.spec