2017-12-05 1 views
0

Windows에서 tkinter 응용 프로그램을 만들었으므로 이제 실행 가능한 버전을 만들고 싶습니다. multiframe.py는 tkinter 어플리케이션의 모든 코드를 포함합니다.cx_Freeze 실행 파일의 구문이 올바르지 않습니다.

하지만 빌드 할 때 항상 구문 오류가 발생하지만 이유는 없습니다. 다음은 cmd 스냅 샷입니다. enter image description here

이 내 setup.py 같은 모습입니다 :

import cx_Freeze 

    base = None 

    if sys.platform == 'Win32': 
      base = "Win32GUI" 

    executables = [cx_Freeze.Executable("frame.py"), base=base, icon='ds.ico'] 

    cx_Freeze.setup(
      name="cuQ", 
      options = {"build_exe": {"packages":["tkinter"], include_files=["ds.ico"]}, 
      version= "0.01", 
      description = "dasdasd", 
      executables = executables 
      ) 
+1

항상 오류 메시지를 텍스트로 표시하고 스크린 샷을 삽입하지 마십시오. 아이콘 파일 등을 포함하기 위해 일부 수정이 필요할 수 있습니다. 스크린 샷의 텍스트를 복사하여 답안이나 Google 검색에서 텍스트를 사용할 수 없습니다. – furas

답변

2

baseicon 그들이 그것을 전달되지 않는 것 코드에 cx_Freeze.Executableoptions이다. cx_Freeze.setup(options = ...에서

executables = cx_Freeze.Executable("frame.py", base=base, icon='ds.ico') 

는 먼저 사전 키 "build_exe" 값의 일부로서 사전 키 "packages"을 추가하고 있지만 갑자기 당신이있어 : 그들은 너무입니다 () 단지 "frame.py"처럼 될 필요는 사용 키 대신 include_files을 추가하려고하면 값의 일부인 사전에 여전히 "packages" ~ "build_exe" 키가 추가됩니다. 설명하기가 어렵습니다. 어쨌든.

import cx_Freeze, sys 

base = None 

if sys.platform == 'Win32': 
    base = "Win32GUI" 

executables = cx_Freeze.Executable("frame.py", base=base, icon='ds.ico') 

cx_Freeze.setup(
     name="cYou", 
     options = {"build_exe": {"packages":["tkinter"], "include_files":["ds.ico"]}}, 
     version= "0.01", 
     description = "dasdasd", 
     executables = executables 
     ) 
아래

내가 Tkinter를 사용할 것입니다 : 같은

전체 코드가 보일 것입니다. 나는이 스크립트 옆에 내 tkinter 스크립트 something.py을 넣는다. 그럼 난 그저 something에 응답합니다.

from cx_Freeze import setup, Executable 
import sys, os 

fileName = input("What's the name of the py file to be converted to .exe?\n") 
sys.argv.append('build') 

os.environ['TCL_LIBRARY'] = r'C:\Users\username\AppData\Local\Programs\Python\Python36\tcl\tcl8.6' 
os.environ['TK_LIBRARY'] = r'C:\Users\username\AppData\Local\Programs\Python\Python36\tcl\tk8.6' 

base = None 
if (sys.platform == "win32"): 
    base = "Win32GUI" # Tells the build script to hide the console. 
elif (sys.platform == "win64"): 
    base = "Win64GUI" # Tells the build script to hide the console. 



setup(
    name='KutsalAklinNerde?', 
    version='0.1',    #Further information about its version 
    description='Parse stuff', #It's description 
    executables=[Executable(fileName + ".py", base=base)]) 
+0

빠른 답변 주셔서 감사합니다! 이제는 구문 오류가 없지만 다음과 같이합니다. self.executables = list (실행 파일) TypeError : '실행 파일'개체가 반복 가능하지 않습니다. – Marci

+0

무슨 일이 일어나는지 잘 모르겠지만 [이 비디오를 사용하여 exe 변환을위한 스크립트를 만듭니다. ] (https://www.youtube.com/watch?v=GSoOwSqTSrs). – Nae

+0

https://www.youtube.com/watch?v=HosXxXE24hA 내 것이 었습니다. 당신이 보낸 사람이 tkinter에서도 작동합니까? – Marci

관련 문제