2017-12-16 17 views
1

pyinstaller를 사용하여 단일 파일 실행 파일로 고정시키려는 Python 프로그램을 얻으려고하지만 pyinstaller와 관련된 동일한 오류가 계속 발생합니다. 오류를 유발하기 위해 최소한으로 프로그램을 축소했습니다. tkinter 가져 오기.pyinstaller는 tkinter를 사용할 수 없습니다

테스트 프로그램 :

import tkinter as tk 

터미널 명령을

pyinstaller --clean --hidden-import tkinter test.py 

출력 :

1625 INFO: PyInstaller: 3.4.dev0+ab8fd9753 
1625 INFO: Python: 3.6.3 
1647 INFO: Platform: Darwin-17.3.0-x86_64-i386-64bit 
1648 INFO: wrote /Users/jacob/test/test.spec 
1653 INFO: UPX is not available. 
1654 INFO: Removing temporary files and cleaning cache in /Users/jacob/Library/Application Support/pyinstaller 
1655 INFO: Extending PYTHONPATH with paths 
['/Users/jacob/test', '/Users/jacob/test'] 
1656 INFO: checking Analysis 
1656 INFO: Building Analysis because out00-Analysis.toc is non existent 
1656 INFO: Initializing module dependency graph... 
1658 INFO: Initializing module graph hooks... 
1666 INFO: Analyzing base_library.zip ... 
5415 INFO: Analyzing hidden import 'tkinter' 
5568 INFO: running Analysis out00-Analysis.toc 
5595 INFO: Caching module hooks... 
5600 INFO: Analyzing /Users/jacob/test/test.py 
5604 INFO: Loading module hooks... 
5604 INFO: Loading module hook "hook-_tkinter.py"... 
5623 INFO: checking Tree 
5624 INFO: Building Tree because out00-Tree.toc is non existent 
5624 INFO: Building Tree out00-Tree.toc 
5704 INFO: checking Tree 
5704 INFO: Building Tree because out01-Tree.toc is non existent 
5704 INFO: Building Tree out01-Tree.toc 
5746 INFO: Loading module hook "hook-encodings.py"... 
5840 INFO: Loading module hook "hook-xml.py"... 
6143 INFO: Loading module hook "hook-pydoc.py"... 
6157 INFO: Looking for ctypes DLLs 
6157 INFO: Analyzing run-time hooks ... 
6159 INFO: Including run-time hook 'pyi_rth__tkinter.py' 
6168 INFO: Looking for dynamic libraries 
6453 INFO: Looking for eggs 
6453 INFO: Using Python library /Library/Frameworks/Python.framework/Versions/3.6/Python 
6456 INFO: Warnings written to /Users/jacob/test/build/test/warntest.txt 
6483 INFO: Graph cross-reference written to /Users/jacob/test/build/test/xref-test.html 
6507 INFO: checking PYZ 
6507 INFO: Building PYZ because out00-PYZ.toc is non existent 
6508 INFO: Building PYZ (ZlibArchive) /Users/jacob/test/build/test/out00-PYZ.pyz 
6846 INFO: Building PYZ (ZlibArchive) /Users/jacob/test/build/test/out00-PYZ.pyz completed successfully. 
6851 INFO: checking PKG 
6851 INFO: Building PKG because out00-PKG.toc is non existent 
6851 INFO: Building PKG (CArchive) out00-PKG.pkg 
6874 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully. 
6877 INFO: Bootloader /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PyInstaller/bootloader/Darwin-64bit/run 
6877 INFO: checking EXE 
6877 INFO: Building EXE because out00-EXE.toc is non existent 
6877 INFO: Building EXE from out00-EXE.toc 
6883 INFO: Appending archive to EXE /Users/jacob/test/build/test/test 
6888 INFO: Fixing EXE for code signing /Users/jacob/test/build/test/test 
6894 INFO: Building EXE from out00-EXE.toc completed successfully. 
6897 INFO: checking COLLECT 
6897 INFO: Building COLLECT because out00-COLLECT.toc is non existent 
6897 INFO: Building COLLECT out00-COLLECT.toc 
7923 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/da.msg 
7925 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/lv.msg 
7927 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/kl.msg 
7928 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/comdlg.tcl 
7930 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/gv_gb.msg 
7932 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/text.tcl 

    <snipped 298 very similar lines> 

8423 INFO: Building COLLECT out00-COLLECT.toc completed successfully. 

실행 실행에 :

Last login: Sun Dec 17 09:39:40 on ttys001 
Jacobs-MacBook-Pro:~ jacob$ /Users/jacob/test/dist/test/test ; exit; 
Traceback (most recent call last): 
    File "test.py", line 1, in <module> 
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 631, in exec_module 
    exec(bytecode, module.__dict__) 
    File "tkinter/__init__.py", line 36, in <module> 
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 714, in load_module 
    module = loader.load_module(fullname) 
ImportError: dlopen(/Users/jacob/test/dist/test/_tkinter.so, 2): Library not loaded: @loader_path/Tcl 
    Referenced from: /Users/jacob/test/dist/test/_tkinter.so 
    Reason: no suitable image found. Did find: 
    /Users/jacob/test/dist/test/Tcl: not a file 
    /Users/jacob/test/dist/test/Tcl: stat() failed with errno=25 
    /Users/jacob/test/dist/test/Tcl: not a file 
    /Users/jacob/test/dist/test/Tcl: stat() failed with errno=25 
[731] Failed to execute script test 
logout 
Saving session... 
...copying shared history... 
...saving history...truncating history files... 
...completed. 

[Process completed] 

pyinstaller를 사용하여 단일 파일 실행 파일에 동결하기 위해 tkinter를 사용하여 Python 프로그램을 작동시키는 방법은 무엇입니까?

업데이트 : 업데이트 된 출력 및 런타임 오류입니다. 이전과 다른 오류가 발생하여 업데이트되었습니다.

+0

첫 번째'존재하는 파일 : '/ Users/jacob/test/dist/test''는 이미이 파일이 있음을 의미하며 실행하기 전에 삭제해야 할 수도 있습니다. – furas

+0

와우. 그것은 실제로 내가 겪고있는 문제가 아니었지만 여기서 게시하기위한 결과를 얻는 과정에서 일어 났음에 틀림 없다. – Jacob

답변

0

그것은 MacOS에서 Tcl/Tk의 경로와 관련이 있습니다. Pyinstaller의 자체 버전을 컴파일하고 오류를 수정하는 방법을 찾았지만 macinstall을 제외한 모든 것에 대해 Pyinstaller를 깨뜨리는 방법을 찾았습니다.

관련 문제