2017-12-16 11 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の独自のバージョンをコンパイルしてエラーを修正する方法を見つけましたが、PyinstallerをMacOS以外のすべてのバージョンで使用していました。

関連する問題