서버/Python

python file to exe as one file

youGom 2018. 11. 1. 19:18

pip install pyinstaller

python your_script.py
pyinstaller --onefile <your_script_name>.py


pyinstaller의 옵션은 다양하지만 보통 쓰이는 옵션은 몇 개 안된다.

  • -F--onefile: 최종 출력으로 exe파일 하나만 생성한다.
  • -w--windowed: 콘솔 창이 출력되지 않게한다.
  • -i--icon: exe파일의 아이콘을 지정한다.

더 자세한 설명과 옵션들은 아래의 이미지 참고.
options


추가 경로 필요시>>



pyinstaller --onefile --windowed --icon=heart.ico --clean -p C:\test main.py


난 아래껄 쓸예정,

pyinstaller --onefile --strip <your_script_name>.py



출처2 : https://medium.com/dreamcatcher-its-blog/making-an-stand-alone-executable-from-a-python-script-using-pyinstaller-d1df9170e263


출처2 : https://winterj.me/pyinstaller/