回答編集履歴
7
追記
test
CHANGED
@@ -71,3 +71,7 @@
|
|
71
71
|
`Windows`環境で`MultiProcess`や`ProcessPoolExecutor`をもし使用しているなら、
|
72
72
|
|
73
73
|
`freeze_support`を追加記述することをお忘れなく。
|
74
|
+
|
75
|
+
■参考情報
|
76
|
+
|
77
|
+
[multiprocessing#freeze_support](https://docs.python.jp/3/library/multiprocessing.html#multiprocessing.freeze_support)
|
6
追記
test
CHANGED
@@ -28,23 +28,15 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
1,まず、--onefileオプション
|
31
|
+
1,まず、`--onefile`オプションなし(※)で`pyinstaller`でexeファイルを生成し、
|
32
32
|
|
33
|
-
|
33
|
+
`dist/apifile`フォルダ直下にモデルファイルが格納されることを確認してくださいな。
|
34
34
|
|
35
|
-
※格納されているのが確認できれば、--onefileのオプションをつけ直してください。
|
35
|
+
※格納されているのが確認できれば、`--onefile`のオプションをつけ直してください。
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
-
2,上記で格納されていてアプリケーション側でパスが上手く取れない時は以下のような形で取得してみてください。
|
39
|
+
2,上記で格納されていてアプリケーション側でパスが上手く取れない時は以下のような形でパスを取得してみてください。
|
40
|
-
|
41
|
-
あとpythonファイルの内容が分からないので、念のために記載しますが、
|
42
|
-
|
43
|
-
Winwdos環境でMultiProcessやProcessPoolExecutorをもし使用しているなら、
|
44
|
-
|
45
|
-
freeze_supportを追加記述することをお忘れなく。
|
46
|
-
|
47
|
-
|
48
40
|
|
49
41
|
```Python
|
50
42
|
|
@@ -71,3 +63,11 @@
|
|
71
63
|
■参考情報
|
72
64
|
|
73
65
|
[Run-time Information](http://pyinstaller.readthedocs.io/en/stable/runtime-information.html)
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
3, あと`python`ファイルの内容が分からないので、念のために記載しますが、
|
70
|
+
|
71
|
+
`Windows`環境で`MultiProcess`や`ProcessPoolExecutor`をもし使用しているなら、
|
72
|
+
|
73
|
+
`freeze_support`を追加記述することをお忘れなく。
|
5
追記
test
CHANGED
@@ -28,9 +28,11 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
-
1,まず、--onefileオプションをやめて、pyinstallerでexeを生成してdist/win/apifile フォルダにモデルファイルが格納されることを確認してくださいな。
|
31
|
+
1,まず、--onefileオプションをやめて(※)、pyinstallerでexeを生成してdist/win/apifile フォルダにモデルファイルが格納されることを確認してくださいな。
|
32
32
|
|
33
33
|
ファイルがapifileフォルダ直下に配置されていないといけないので。
|
34
|
+
|
35
|
+
※格納されているのが確認できれば、--onefileのオプションをつけ直してください。
|
34
36
|
|
35
37
|
|
36
38
|
|
4
補足
test
CHANGED
@@ -30,11 +30,11 @@
|
|
30
30
|
|
31
31
|
1,まず、--onefileオプションをやめて、pyinstallerでexeを生成してdist/win/apifile フォルダにモデルファイルが格納されることを確認してくださいな。
|
32
32
|
|
33
|
-
ファイルがapifileフォルダに
|
33
|
+
ファイルがapifileフォルダ直下に配置されていないといけないので。
|
34
34
|
|
35
35
|
|
36
36
|
|
37
|
-
2,上記で
|
37
|
+
2,上記で格納されていてアプリケーション側でパスが上手く取れない時は以下のような形で取得してみてください。
|
38
38
|
|
39
39
|
あとpythonファイルの内容が分からないので、念のために記載しますが、
|
40
40
|
|
@@ -65,3 +65,7 @@
|
|
65
65
|
model_file = Path(APPLICATION_PATH, "model.sav")
|
66
66
|
|
67
67
|
```
|
68
|
+
|
69
|
+
■参考情報
|
70
|
+
|
71
|
+
[Run-time Information](http://pyinstaller.readthedocs.io/en/stable/runtime-information.html)
|
3
追記
test
CHANGED
@@ -62,6 +62,6 @@
|
|
62
62
|
|
63
63
|
|
64
64
|
|
65
|
-
model_file = Path(APPLICATION_PATH, "model.sav
|
65
|
+
model_file = Path(APPLICATION_PATH, "model.sav")
|
66
66
|
|
67
67
|
```
|
2
追記
test
CHANGED
@@ -21,3 +21,47 @@
|
|
21
21
|
- [Adding Data Files](http://pyinstaller.readthedocs.io/en/stable/spec-files.html#adding-data-files)
|
22
22
|
|
23
23
|
- [What to bundle, where to search](http://pyinstaller.readthedocs.io/en/stable/usage.html#options-group-what-to-bundle-where-to-search)
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
---
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
1,まず、--onefileオプションをやめて、pyinstallerでexeを生成してdist/win/apifile フォルダにモデルファイルが格納されることを確認してくださいな。
|
32
|
+
|
33
|
+
ファイルがapifileフォルダにコピーされていないといけないので。
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
2,上記で問題なく、アプリケーションパスが上手く取れない時は以下のような形で取得してみてください。
|
38
|
+
|
39
|
+
あとpythonファイルの内容が分からないので、念のために記載しますが、
|
40
|
+
|
41
|
+
Winwdos環境でMultiProcessやProcessPoolExecutorをもし使用しているなら、
|
42
|
+
|
43
|
+
freeze_supportを追加記述することをお忘れなく。
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
```Python
|
48
|
+
|
49
|
+
from pathlib import Path
|
50
|
+
|
51
|
+
import sys
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
if getattr(sys, 'frozen', False):
|
56
|
+
|
57
|
+
APPLICATION_PATH = sys._MEIPASS
|
58
|
+
|
59
|
+
else:
|
60
|
+
|
61
|
+
APPLICATION_PATH = str(Path(__file__).parent)
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
model_file = Path(APPLICATION_PATH, "model.sav'")
|
66
|
+
|
67
|
+
```
|
1
追記
test
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
モデルファイルも一緒に配布したいという要件と認識して回答します。
|
6
6
|
|
7
|
-
apifile.specファイルのdatasオプションに値を設定していないのではないでしょうか。
|
7
|
+
`apifile.spec`ファイルの`datas`オプションに値を設定していないのではないでしょうか。
|
8
8
|
|
9
9
|
|
10
10
|
|
@@ -12,10 +12,12 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
`apifile.spec`ファイルの`datas`オプションでも指定可能です。
|
15
|
+
`apifile.spec`ファイル内の`datas`オプションでも指定可能です。
|
16
16
|
|
17
17
|
■参考情報
|
18
18
|
|
19
19
|
- [pythonのGUIアプリを.exe化](https://qiita.com/yukiozawa/items/dd87ed281ea81d972e16)
|
20
20
|
|
21
21
|
- [Adding Data Files](http://pyinstaller.readthedocs.io/en/stable/spec-files.html#adding-data-files)
|
22
|
+
|
23
|
+
- [What to bundle, where to search](http://pyinstaller.readthedocs.io/en/stable/usage.html#options-group-what-to-bundle-where-to-search)
|