実現したいこと
Python nuitkaの --standaloneで作成したEXEが起動しない件
前提
環境
Windows10 Home
Python 3.11.6 (x64)
エディタ[VScode]
インポートしているライブラリは以下の通りです。
import os
import time
import glob
import shutil
import winreg
import PySimpleGUI as sg
TEST.pyを作成し、VScodeからの動作確認と合わせ PyInstaller, py2exe, cx_Freeze からEXE化は成功して、各々動作確認はしております。
Nuitkaでの動作確認を行おうと > python -m nuitka TEST.py から出来上がった TEST.cmd & TEST.exe はどちらからでも起動&動作を確認しています。
--standaloneのオプションを付けてコンパイルすると以下のリストの通り、実行ファイルは出来上がっているようなのですが、起動させるとコンソルーが一瞬開いた後、動きがありません。
コンパイル中にエラーは出ていないようですが、出来上がったフォルダ内で何かファイルが足りないのかどうかも不明で、起動せず音沙汰無しの状態です。
それらしきオプションを付けて色々試してはみたのですが、結果は同じで悩んでおります。
発生している問題・エラーメッセージ
PS C:\Users\a> python -m nuitka --standalone TEST.py Nuitka-Options:INFO: Used command line options: --standalone TEST.py Nuitka:INFO: Starting Python compilation with Nuitka '1.9.2' on Python '3.11' commercial grade 'not installed'. Nuitka:INFO: Completed Python level compilation and optimization. Nuitka:INFO: Generating source code for C backend compiler. Nuitka:INFO: Running data composer tool for optimal constant value handling. Nuitka:INFO: Running C compilation via Scons. Nuitka-Scons:INFO: Backend C compiler: gcc (gcc 13.2.0). Nuitka-Scons:INFO: Backend linking program with 8 files (no progress information available for this stage). Nuitka-Scons:INFO: Compiled 8 C files using ccache. Nuitka-Scons:INFO: Cached C files (using ccache) with result 'cache hit': 8 Nuitka:INFO: Keeping build directory 'TEST.build'. Nuitka:INFO: Successfully created 'TEST.dist\TEST.exe'``` 解決方法などお分かりの方いらっしゃいましたら、ご教示頂けると幸いです。
> 起動させるとコンソルーが一瞬開いた後、動きがありません。
こういう場合は、コマンドプロンプトやpowershellを開いてそこからexeを実行すると、エラーメッセージなどが確認できることがあります。
試してみて結果を追記いただけますか。
TakaiYさん
お返事が遅くなり申し訳御座いませんでした。
ご指摘の方法で確認してみました。
PS C:\Users\a> test.dist\test.exe
Nuitka: Need to use '--enable-plugin=tk-inter' option during compilation for tk-inter to work!
『コンパイル中に '--enable-plugin=tk-inter' オプションを使用する必要があります。』と表示されました。
早速このオプションを付けてコンパイルしたところ 無事動作させることが出来ました。
こういう方法があるのですね、本当に勉強になりました。有り難う御座いました。

回答1件
あなたの回答
tips
プレビュー