2017-05-15 3 views
0

나는 프랑스어로 내 영어를 유감스럽게 생각합니다. 사실 tkinter, paramiko, telnetlib 등을 사용하는 Python 3.6.1 프로그램을 만들고 cx_Freeze로 exe 파일을 만들고 싶습니다. "Hello World"프로그램은 성공하지만 Tkinter 만 사용해도 작동하지 않습니다. exe를 실행할 때 0.5 초 이상 터미널을 볼 수 없기 때문에 오류 화면이 나타납니다. 그래서 나는 그 화면을 내 setup.py와 결합시킨다.cx_Freeze with Tkinter

setup.py :

import cx_Freeze 
import os 

os.environ['TCL_LIBRARY'] = r'C:\LOCAL_TO_PYTHON\Python35-32\tcl\tcl8.6' 
os.environ['TK_LIBRARY'] = r'C:\LOCAL_TO_PYTHON\Python35-32\tcl\tk8.6' 

executables= [cx_Freeze.Executable('exeTest.py',)] 


cx_Freeze.setup(

    name = "leTest", 
    options = {'built.exe':{'includes': ['tkinter','paramiko','telnetlib']}}, 
    version = "1.0", 
    description = "Bonjour !", 
    executables = executables, 
) 

오류 : R에 대한

Traceback (most recent call last): 
    File "C:\Python36\lib\site-packages\cx_Freeze\initscripts\__startup.py", in line 12, in <module> 
    __import__(name+"__init__") 
    File "C:\Python36\lib\site-packages\cx_Freeze\initscripts\Console.py", in line 24, in <module> 
     exec(code, m.__dict__) 
    File "exeTest.py", line 9, in <module> 
    File "C:\Python36\lib\tkinter\__init.py", in line 36, in <module> 
    import _tkinter # If this fails your Python may not be configured fot Tk 
    ImportError: DLL load failed: The specified module can not be found. 

감사합니다 도움을 청할 것입니다.

+0

실제로 이것은 전체 추적이 아니므로 진단하기가 어려울 수 있습니다. 전체 추적을 얻을 수있는 방법이 있습니까? 사전에이 오류는 사용자가 가져 오기를 시도하고 있으며 실패했음을 나타냅니다. – eijen

+0

스크린 샷을 보낼 수 없습니다. ( – Rafiki

+0

스크린 샷에 무엇을 입력해야합니까? 오류가 이미지에있어 나중에 검색 할 수없는 경우 동일한 문제가있는 사용자에게 도움이되지 않습니다. – eijen

답변

0

이 기능을 사용해보십시오. 확실히 이것이 파이썬 설치가 PATH의 일부라고 가정합니다.

import sys 
import os 
from cx_Freeze import setup, Executable 
import cx_Freeze 
import tkinter 
import os.path 
import scipy 

base = None 

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


PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__)) 
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6') 
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6') 

#os.environ['TCL_LIBRARY'] = r'C:\Users\matthew\Downloads\WinPython-64bit-3.5.3.0Qt5\python-3.5.3.amd64\tcl\tcl8.6' 
#os.environ['TK_LIBRARY'] = r'C:\Users\matthew\Downloads\WinPython-64bit-3.5.3.0Qt5\python-3.5.3.amd64\tcl\tk8.6' 

executables = [cx_Freeze.Executable("exeTest.py", base=base)] 
addtional_mods = ['numpy.core._methods', 'numpy.lib.format'] 

packages = ["idna", "numpy",] 
options = { 
    'build_exe': { 

     'include_files':[ 
      os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'), 
      os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'), 
      os.path.dirname(scipy.__file__), 

     ], 
     'includes': addtional_mods, 
     'packages':packages, 
    }, 

} 

cx_Freeze.setup(
    name = "letest", 
    options = options, 
    version = "0.01", 
    description = 'Bonjour', 
    executables = executables 
) 
+0

이전에 .exe를 만들었지 만 괜찮습니다.하지만 작동하지 않습니다 ... 같은 오류가 있지만 특정 창에서 읽을 수 있도록 사진을 보낼 수 없습니다. ( – Rafiki

+0

그 대답을 주신 고맙습니다 – Rafiki

+0

DLL에 DLL이 누락되었다고 오류가 나타 났습니까? – Gardener85