Python

Compile

exe로 컴파일 (cx_Freeze 이용)

홍사훈     0건     233회

본문

## MyPython.py 작성

  

## compile.py 작성

  ​# compile.py

  from cx_Freeze import setup, Executable

 

  buildOptions = {

      "packages":[# 추가할 모듈

          'pyautogui', 'io'

          ],

      "excludes":[# 제외할 모듈

          'numpy'

          ]

  }

 

  base = None

  if sys.platform == "win32":

      base = "Win32GUI"


  exe = [Executable('MyPython.py', 

                    base=base,

#target_name="MyPython.exe", 

                    icon='sahoon.ico'

                    )]

 

  setup( 

      name   ='main'   # 제품이름 

      version='0.0.1.0'# 제품버전

      description='',  # 파일설명

      author='',

      options = dict(build_exe=buildOptions),

      executables = exe


## cx_Freeze로 컴파일

  c:\python> python.exe compile.py build   

  # build\exe.win-amd64-3.9 폴더안에 파일이 생성됨

 

 

등록된 댓글이 없습니다.



Copyrightⓡ1996~2025, sahoon.com All Rights Reserved.