pyinstallerを使って学習ずみのモデル「model_9.h5」をロードするpythonファイル「main.py」をexe化しましたが、exeファイルを実行すると、
Traceback (most recent call last):
File "main.py", line 19, in <module>
File "site-packages/keras/engine/saving.py", line 417, in load_model
File "site-packages/keras/utils/io_utils.py", line 186, in init
File "site-packages/h5py/_hl/files.py", line 312, in init
File "site-packages/h5py/_hl/files.py", line 142, in make_fid
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5f.pyx", line 78, in h5py.h5f.open
OSError: Unable to open file (unable to open file: name = './model_9.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
[20378] Failed to execute script main
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
以上のエラーが出ます。
main.pyとmodel_9.h5は同じディレクトリ内にあり、読み込む際は
python
1model = load_model("./model_9.h5")
のように相対パスを使っています。
exe化しない元の段階のファイルではうまく動くのですが...
どうしたらexeファイルでも読み込めるようになるのでしょうか。
環境はanaconda4.7.11、PCはMacです。
あなたの回答
tips
プレビュー