본문 바로가기

카테고리 없음

pyinstaller 튜토리얼 소개: py 파일을 exe 파일로 변환하기

pyinstaller 사용이 처음이라 상당히 애를 먹었습니다. 세 가지 어려움이 있었는데요.

 

1) 특정 파일을 binary형태로 exe 파일에 포함시키는 것

2) RuntimeError: maximum recursion depth exceeded while calling a Python object 처리

3) 완성된 exe 파일의 속도 문제(너무 느림)

 

3번은 아직 해결 중이지만 위의 1, 2번은 해결했습니다. 해결에 도움이 된 참고 자료를 공유합니다.

 

--add-binary "파일" 

유튜브 영상과 stackoverflow에서 방법을 찾을 수 있었습니다. --add-binary에 대한 상세 내용은 링크를 참고해주세요.

 

pyinstaller -w -F --add-binary "C:\파일명.exe;." 파일명.py

 

-F 옵션 부여시 import 라이브러리 모두 하나의 exe 파일안에 포함됩니다.

 

 

#유튜브

https://www.youtube.com/watch?v=S0u-WhLSUag

 

#스택오버플로우

https://stackoverflow.com/questions/54470616/python-pyinstaller-gui-tkinter-selenium

 

Python Pyinstaller GUI Tkinter Selenium

I did not know how to create an executable python program before I asked here. Thankfully I received a fast answer and was able to convert my script to an executable program. The executable works p...

stackoverflow.com

 

maximum recursion depth exceeded

해당 내용으로 스택오버플로우에 답변이 있어서 쉽게 해결했습니다. spec 파일에서 약간의 코드만 추가하면 손쉽게 처리할 수 있습니다.

 

import sys
sys.setrecursionlimit(5000)

 

 

#스택오버플로우

https://stackoverflow.com/questions/38977929/pyinstaller-creating-exe-runtimeerror-maximum-recursion-depth-exceeded-while-ca

 

pyinstaller creating EXE RuntimeError: maximum recursion depth exceeded while calling a Python object

I am running WinPython 3.4.4.3 with pyinstaller 3.2 (obtained via pip install pyinstaller). Now I've got some really simple Qt4 code that I want to convert to EXE and I've run into problem that I ...

stackoverflow.com

 

3번은 해결하려면 더 알아봐야 할 것 같습니다.