前提・実現したいこと
動作中のPythonFile(高齢者運転免許試験7)をexe化したが、不動作でした。
何がいけないのか教えて欲しいのです。 宜しくお願い致します。
発生している問題・エラーメッセージ
下記のエラーが表示されます 作ったexeファイルをクリックしても、「Failed to execute script 高齢者運転免許試験7」 と表示され動作しません。 exe化の詳細下記に載せました。
試したこと
・数回exe化をtryしましたが、同じ結果でした。
・別の場所にあるPCで、同じような方法でexe化したものも動作しませんでした。
・exe化するときの方法 コマンドプロンプト:下記へコピペしました。
''''''''''''''''''''''''''''''''''''
C:\WINDOWS\system32>cd C:\Users\tak11\デスクトップ\exe_file7
C:\Users\tak11\デスクトップ\exe_file7>pyinstaller --onefile --noconsole 高齢者運転免許試験7.py
140 INFO: PyInstaller: 3.5
141 INFO: Python: 3.7.3
141 INFO: Platform: Windows-10-10.0.17763-SP0
149 INFO: wrote C:\Users\tak11\デスクトップ\exe_file7\高齢者運転免許試験7.spec
151 INFO: UPX is not available.
152 INFO: Extending PYTHONPATH with paths
['C:\Users\tak11\デスクトップ\exe_file7', 'C:\Users\tak11\デスクトップ\exe_file7']
152 INFO: checking Analysis
153 INFO: Building Analysis because Analysis-00.toc is non existent
153 INFO: Initializing module dependency graph...
157 INFO: Initializing module graph hooks...
166 INFO: Analyzing base_library.zip ...
5352 INFO: running Analysis Analysis-00.toc
5358 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\tak11\appdata\local\programs\python\python37\python.exe
6017 INFO: Caching module hooks...
6047 INFO: Analyzing C:\Users\tak11\デスクトップ\exe_file7\高齢者運転免許試験7.py
6687 INFO: Processing pre-find module path hook distutils
8944 INFO: Processing pre-find module path hook site
8946 INFO: site: retargeting to fake-dir 'c:\users\tak11\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\fake-modules'
10871 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
14638 INFO: Loading module hooks...
14638 INFO: Loading module hook "hook-distutils.py"...
14644 INFO: Loading module hook "hook-encodings.py"...
14706 INFO: Loading module hook "hook-lib2to3.py"...
14715 INFO: Loading module hook "hook-numpy.core.py"...
14798 INFO: Loading module hook "hook-numpy.py"...
14799 INFO: Loading module hook "hook-PIL.Image.py"...
15293 INFO: Loading module hook "hook-PIL.py"...
15295 INFO: Excluding import 'tkinter'
15297 INFO: Removing import of tkinter from module PIL.ImageTk
15297 INFO: Import to be excluded not found: 'FixTk'
15298 INFO: Excluding import 'PySide'
15299 INFO: Removing import of PySide from module PIL.ImageQt
15300 INFO: Excluding import 'PyQt4'
15301 INFO: Removing import of PyQt4 from module PIL.ImageQt
15302 INFO: Excluding import 'PyQt5'
15303 INFO: Removing import of PyQt5 from module PIL.ImageQt
15304 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
15306 INFO: Excluding import 'tkinter'
15307 INFO: Import to be excluded not found: 'FixTk'
15307 INFO: Loading module hook "hook-pkg_resources.py"...
15535 INFO: Processing pre-safe import module hook win32com
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
15582 INFO: Processing pre-safe import module hook win32com
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
15888 INFO: Loading module hook "hook-pydoc.py"...
15890 INFO: Loading module hook "hook-scipy.py"...
15904 INFO: Loading module hook "hook-setuptools.py"...
16407 INFO: Loading module hook "hook-sysconfig.py"...
16409 INFO: Loading module hook "hook-xml.dom.domreg.py"...
16411 INFO: Loading module hook "hook-xml.py"...
16413 INFO: Loading module hook "hook-_tkinter.py"...
16613 INFO: checking Tree
16613 INFO: Building Tree because Tree-00.toc is non existent
16613 INFO: Building Tree Tree-00.toc
16798 INFO: checking Tree
16798 INFO: Building Tree because Tree-01.toc is non existent
16799 INFO: Building Tree Tree-01.toc
16865 INFO: Looking for ctypes DLLs
16906 INFO: Analyzing run-time hooks ...
16912 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
16927 INFO: Including run-time hook 'pyi_rth_pkgres.py'
16935 INFO: Including run-time hook 'pyi_rth__tkinter.py'
16952 INFO: Looking for dynamic libraries
21569 INFO: Looking for eggs
21570 INFO: Using Python library c:\users\tak11\appdata\local\programs\python\python37\python37.dll
21570 INFO: Found binding redirects:
[]
21582 INFO: Warnings written to C:\Users\tak11\デスクトップ\exe_file7\build\高齢者運転免許試験7\warn-高齢者運転免許試験7.txt
21686 INFO: Graph cross-reference written to C:\Users\tak11\デスクトップ\exe_file7\build\高齢者運転免許試験7\xref-高齢者運転免許試験7.html
21769 INFO: checking PYZ
21769 INFO: Building PYZ because PYZ-00.toc is non existent
21770 INFO: Building PYZ (ZlibArchive) C:\Users\tak11\デスクトップ\exe_file7\build\高齢者運転免許試験7\PYZ-00.pyz
22810 INFO: Building PYZ (ZlibArchive) C:\Users\tak11\デスクトップ\exe_file7\build\高齢者運転免許試験7\PYZ-00.pyz completed successfully.
22841 INFO: checking PKG
22842 INFO: Building PKG because PKG-00.toc is non existent
22842 INFO: Building PKG (CArchive) PKG-00.pkg
42864 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
42900 INFO: Bootloader c:\users\tak11\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe
42901 INFO: checking EXE
42901 INFO: Building EXE because EXE-00.toc is non existent
42902 INFO: Building EXE from EXE-00.toc
42903 INFO: Appending archive to EXE C:\Users\tak11\デスクトップ\exe_file7\dist\高齢者運転免許試験7.exe
43113 INFO: Building EXE from EXE-00.toc completed successfully.
'''''''''''''''''''''''''''''
補足情報(FW/ツールのバージョンなど)
W10 64bit
Python3.7
ここにより詳細な情報を記載してください。
念のため、長くなりますがfileのcodeを書きします。
'''''''''''''''''''''''''
#高齢者運転免許試験7.py 8/9/2019 完成、動作中
#乱数でpng画像を切り替える.py 8/8/2019
#全画像に品物の名前を追加 8/9/2019
import time
import tkinter as tk
import random
from PIL import Image, ImageTk
root = tk.Tk()
root.title("グループ画像を当てる")
root.geometry('350x500')
#ボタン「次へ」が押されたときの画像処理
def select_img_file():
global ran
ran = random.randrange(1, 65)
photo_file = str(ran)+'.png'
#print(photo_file)
return photo_file
def push_next_button(event):
img_next = ImageTk.PhotoImage(Image.open(select_img_file()))
panel.configure(image = img_next)
panel.photo = img_next
#print(ran)
def push_png_button(event):
global ran
if ran <= 4: image_png = ImageTk.PhotoImage(Image.open("A_1a.png")) panel.configure(image = image_png) panel.photo = image_png #print(image_png) elif ran <= 8 and ran >= 5: image_png = ImageTk.PhotoImage(Image.open("A_2a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 12 and ran >= 9: image_png = ImageTk.PhotoImage(Image.open("A_3a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 16 and ran >= 13: image_png = ImageTk.PhotoImage(Image.open("A_4a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 20 and ran >= 17: image_png = ImageTk.PhotoImage(Image.open("B_1a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 24 and ran >= 21: image_png = ImageTk.PhotoImage(Image.open("B_2a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 28 and ran >= 25: image_png = ImageTk.PhotoImage(Image.open("B_3a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 32 and ran >= 29: image_png = ImageTk.PhotoImage(Image.open("B_4a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 36 and ran >= 33: image_png = ImageTk.PhotoImage(Image.open("C_1a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 40 and ran >= 37: image_png = ImageTk.PhotoImage(Image.open("C_2a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 44 and ran >= 41: image_png = ImageTk.PhotoImage(Image.open("C_3a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 48 and ran >= 45: image_png = ImageTk.PhotoImage(Image.open("C_4a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 52 and ran >= 49: image_png = ImageTk.PhotoImage(Image.open("D_1a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 56 and ran >= 53: image_png = ImageTk.PhotoImage(Image.open("D_2a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 60 and ran >= 57: image_png = ImageTk.PhotoImage(Image.open("D_3a.png")) panel.configure(image = image_png) panel.photo = image_png elif ran <= 64 and ran >= 61: image_png = ImageTk.PhotoImage(Image.open("D_4a.png")) panel.configure(image = image_png) panel.photo = image_png
img = ImageTk.PhotoImage(Image.open(select_img_file()))
panel = tk.Label(root,image = img)
panel.pack(side = "bottom", fill = "both", expand = "yes")
panel.place(x=45,y=10)
btn1=tk.Button(root, text='画像切換')
btn1.place(x=70,y=430)
btn1.bind("<1>", push_next_button)
btn2=tk.Button(root, text='全画像表示')
btn2.place(x=200,y=430)
btn2.bind("<1>", push_png_button)
root.mainloop()
'''''''''''''''''''''''''''
回答2件
あなたの回答
tips
プレビュー