質問編集履歴

8

Markdownを変更。

2018/03/19 00:23

投稿

miyakazu
miyakazu

スコア7

test CHANGED
File without changes
test CHANGED
@@ -116,7 +116,7 @@
116
116
 
117
117
  himports = [
118
118
 
119
- 'pandas', 'sklearn']**
119
+ 'pandas', 'sklearn']
120
120
 
121
121
 
122
122
 

7

Markdownを変更。

2018/03/19 00:23

投稿

miyakazu
miyakazu

スコア7

test CHANGED
File without changes
test CHANGED
@@ -114,29 +114,29 @@
114
114
 
115
115
 
116
116
 
117
- **himports = [
117
+ himports = [
118
118
 
119
119
  'pandas', 'sklearn']**
120
120
 
121
121
 
122
122
 
123
- **def get_pandas_path():
123
+ def get_pandas_path():
124
124
 
125
125
  import pandas
126
126
 
127
127
  pandas_path = pandas.__path__[0]
128
128
 
129
- return pandas_path**
129
+ return pandas_path
130
-
131
-
132
-
130
+
131
+
132
+
133
- **def get_sklearn_path():
133
+ def get_sklearn_path():
134
134
 
135
135
  import sklearn
136
136
 
137
137
  sklearn_path = sklearn.__path__[0]
138
138
 
139
- return sklearn_path**
139
+ return sklearn_path
140
140
 
141
141
 
142
142
 
@@ -164,21 +164,21 @@
164
164
 
165
165
 
166
166
 
167
- **dict_tree = Tree(get_pandas_path(), prefix='pandas', excludes=["*.pyc"])
167
+ dict_tree = Tree(get_pandas_path(), prefix='pandas', excludes=["*.pyc"])
168
168
 
169
169
  a.datas += dict_tree
170
170
 
171
- a.binaries = filter(lambda x: 'pandas' not in x[0], a.binaries)**
171
+ a.binaries = filter(lambda x: 'pandas' not in x[0], a.binaries)
172
-
173
-
174
-
175
- **
172
+
173
+
174
+
175
+
176
176
 
177
177
  dict_tree = Tree(get_sklearn_path(), prefix='sklearn', excludes=["*.pyc"])
178
178
 
179
179
  a.datas += dict_tree
180
180
 
181
- a.binaries = filter(lambda x: 'sklearn' not in x[0], a.binaries)**
181
+ a.binaries = filter(lambda x: 'sklearn' not in x[0], a.binaries)
182
182
 
183
183
 
184
184
 

6

Markdown法を使用。

2018/03/19 00:21

投稿

miyakazu
miyakazu

スコア7

test CHANGED
File without changes
test CHANGED
@@ -1,14 +1,12 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
-
4
-
5
3
  Python3.6のsklearnを使用して簡単な重回帰分析を行うプログラムをexeで動かしたい。
6
4
 
7
5
 
8
6
 
9
7
  ### 発生している問題・エラーメッセージ
10
8
 
11
- '''
9
+ ```Python
12
10
 
13
11
  Traceback (most recent call last):
14
12
 
@@ -96,7 +94,7 @@
96
94
 
97
95
  [11720] Failed to execute script SimplePred01
98
96
 
99
- '''
97
+ ```
100
98
 
101
99
 
102
100
 
@@ -106,7 +104,7 @@
106
104
 
107
105
  他ブログ等を参考にして、pandasは読み込んだが、sklearnを読み込んでいないっぽい。
108
106
 
109
- '''
107
+ ```Python
110
108
 
111
109
  # -*- mode: python -*-
112
110
 
@@ -116,35 +114,29 @@
116
114
 
117
115
 
118
116
 
119
- #試したこと2↓
120
-
121
- himports = [
117
+ **himports = [
122
-
118
+
123
- 'pandas', 'sklearn']
119
+ 'pandas', 'sklearn']**
124
-
125
-
126
-
127
- #試したこと3↓
120
+
128
-
121
+
122
+
129
- def get_pandas_path():
123
+ **def get_pandas_path():
130
124
 
131
125
  import pandas
132
126
 
133
127
  pandas_path = pandas.__path__[0]
134
128
 
135
- return pandas_path
129
+ return pandas_path**
136
-
137
-
138
-
139
- 試したこと4↓
130
+
140
-
131
+
132
+
141
- def get_sklearn_path():
133
+ **def get_sklearn_path():
142
134
 
143
135
  import sklearn
144
136
 
145
137
  sklearn_path = sklearn.__path__[0]
146
138
 
147
- return sklearn_path
139
+ return sklearn_path**
148
140
 
149
141
 
150
142
 
@@ -172,23 +164,21 @@
172
164
 
173
165
 
174
166
 
175
- #試したこと3↓
176
-
177
- dict_tree = Tree(get_pandas_path(), prefix='pandas', excludes=["*.pyc"])
167
+ **dict_tree = Tree(get_pandas_path(), prefix='pandas', excludes=["*.pyc"])
178
168
 
179
169
  a.datas += dict_tree
180
170
 
181
- a.binaries = filter(lambda x: 'pandas' not in x[0], a.binaries)
171
+ a.binaries = filter(lambda x: 'pandas' not in x[0], a.binaries)**
182
-
183
-
184
-
172
+
173
+
174
+
185
- 試したこと4↓
175
+ **
186
176
 
187
177
  dict_tree = Tree(get_sklearn_path(), prefix='sklearn', excludes=["*.pyc"])
188
178
 
189
179
  a.datas += dict_tree
190
180
 
191
- a.binaries = filter(lambda x: 'sklearn' not in x[0], a.binaries)
181
+ a.binaries = filter(lambda x: 'sklearn' not in x[0], a.binaries)**
192
182
 
193
183
 
194
184
 
@@ -226,17 +216,17 @@
226
216
 
227
217
  name='SimplePred01')
228
218
 
229
- '''
219
+ ```
230
220
 
231
221
  ### 試したこと
232
222
 
233
223
  1. venv仮想環境で最低限のモジュールでexe化。
234
224
 
235
- 2. .specにhimports = ['pandas', 'sklearn']を追加。
225
+ 2. .specに`himports = ['pandas', 'sklearn']`を追加。
236
-
226
+
237
- 3. .specにget_pandas_path()などを追加。pandasは読み込まれるようになった。
227
+ 3. .specに`get_pandas_path()`などを追加。pandasは読み込まれるようになった。
238
-
228
+
239
- 4. .specにget_sklearn_path()などを追加。sklearnは読み込まなかった。
229
+ 4. .specに`get_sklearn_path()`などを追加。sklearnは読み込まなかった。
240
230
 
241
231
 
242
232
 

5

試したことの詳細を記述。

2018/03/19 00:15

投稿

miyakazu
miyakazu

スコア7

test CHANGED
File without changes
test CHANGED
@@ -116,12 +116,16 @@
116
116
 
117
117
 
118
118
 
119
+ #試したこと2↓
120
+
119
121
  himports = [
120
122
 
121
123
  'pandas', 'sklearn']
122
124
 
123
125
 
124
126
 
127
+ #試したこと3↓
128
+
125
129
  def get_pandas_path():
126
130
 
127
131
  import pandas
@@ -132,6 +136,8 @@
132
136
 
133
137
 
134
138
 
139
+ 試したこと4↓
140
+
135
141
  def get_sklearn_path():
136
142
 
137
143
  import sklearn
@@ -166,6 +172,8 @@
166
172
 
167
173
 
168
174
 
175
+ #試したこと3↓
176
+
169
177
  dict_tree = Tree(get_pandas_path(), prefix='pandas', excludes=["*.pyc"])
170
178
 
171
179
  a.datas += dict_tree
@@ -174,6 +182,8 @@
174
182
 
175
183
 
176
184
 
185
+ 試したこと4↓
186
+
177
187
  dict_tree = Tree(get_sklearn_path(), prefix='sklearn', excludes=["*.pyc"])
178
188
 
179
189
  a.datas += dict_tree
@@ -220,11 +230,13 @@
220
230
 
221
231
  ### 試したこと
222
232
 
223
-
224
-
225
- venv仮想環境で最低限のモジュールでexe化
233
+ 1. venv仮想環境で最低限のモジュールでexe化
234
+
226
-
235
+ 2. .specにhimports = ['pandas', 'sklearn']を追加。
236
+
237
+ 3. .specにget_pandas_path()などを追加。pandasは読み込まれるようになった。
238
+
227
- .specを他記事を参考していじってpandasは読み込んだが、sklearnは読み込
239
+ 4. .specにget_sklearn_path()などを追加。sklearnは読み込かった
228
240
 
229
241
 
230
242
 

4

"""でソースとエラーを囲む

2018/03/19 00:11

投稿

miyakazu
miyakazu

スコア7

test CHANGED
File without changes
test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  ### 発生している問題・エラーメッセージ
10
10
 
11
- """
11
+ '''
12
12
 
13
13
  Traceback (most recent call last):
14
14
 
@@ -96,7 +96,7 @@
96
96
 
97
97
  [11720] Failed to execute script SimplePred01
98
98
 
99
- """
99
+ '''
100
100
 
101
101
 
102
102
 
@@ -106,7 +106,7 @@
106
106
 
107
107
  他ブログ等を参考にして、pandasは読み込んだが、sklearnを読み込んでいないっぽい。
108
108
 
109
- """
109
+ '''
110
110
 
111
111
  # -*- mode: python -*-
112
112
 
@@ -216,7 +216,7 @@
216
216
 
217
217
  name='SimplePred01')
218
218
 
219
- """
219
+ '''
220
220
 
221
221
  ### 試したこと
222
222
 

3

"""でソースとエラーを囲む

2018/03/18 23:46

投稿

miyakazu
miyakazu

スコア7

test CHANGED
File without changes
test CHANGED
@@ -8,6 +8,8 @@
8
8
 
9
9
  ### 発生している問題・エラーメッセージ
10
10
 
11
+ """
12
+
11
13
  Traceback (most recent call last):
12
14
 
13
15
  File "SimplePred01.py", line 3, in <module>
@@ -94,6 +96,8 @@
94
96
 
95
97
  [11720] Failed to execute script SimplePred01
96
98
 
99
+ """
100
+
97
101
 
98
102
 
99
103
  ### 該当のソースコード
@@ -102,7 +106,7 @@
102
106
 
103
107
  他ブログ等を参考にして、pandasは読み込んだが、sklearnを読み込んでいないっぽい。
104
108
 
105
-
109
+ """
106
110
 
107
111
  # -*- mode: python -*-
108
112
 
@@ -212,7 +216,7 @@
212
216
 
213
217
  name='SimplePred01')
214
218
 
215
-
219
+ """
216
220
 
217
221
  ### 試したこと
218
222
 

2

コードとエラーを追加。

2018/03/18 23:44

投稿

miyakazu
miyakazu

スコア7

test CHANGED
File without changes
test CHANGED
@@ -8,17 +8,209 @@
8
8
 
9
9
  ### 発生している問題・エラーメッセージ
10
10
 
11
-
11
+ Traceback (most recent call last):
12
+
12
-
13
+ File "SimplePred01.py", line 3, in <module>
14
+
15
+ import sklearn
16
+
17
+ File "c:\venv\ins\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
18
+
19
+ line 631, in exec_module
20
+
21
+ exec(bytecode, module.__dict__)
22
+
23
+ File "lib\site-packages\sklearn\__init__.py", line 134, in <module>
24
+
25
+ File "c:\venv\ins\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
26
+
27
+ line 631, in exec_module
28
+
29
+ exec(bytecode, module.__dict__)
30
+
31
+ File "lib\site-packages\sklearn\base.py", line 13, in <module>
32
+
33
+ File "c:\venv\ins\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
34
+
35
+ line 631, in exec_module
36
+
37
+ exec(bytecode, module.__dict__)
38
+
39
+ File "lib\site-packages\sklearn\utils\__init__.py", line 11, in <module>
40
+
41
+ File "c:\venv\ins\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
42
+
43
+ line 631, in exec_module
44
+
45
+ exec(bytecode, module.__dict__)
46
+
47
+ File "lib\site-packages\sklearn\utils\validation.py", line 18, in <module>
48
+
49
+ File "c:\venv\ins\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
50
+
51
+ line 631, in exec_module
52
+
53
+ exec(bytecode, module.__dict__)
54
+
55
+ File "lib\site-packages\sklearn\utils\fixes.py", line 144, in <module>
56
+
57
+ File "c:\venv\ins\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
58
+
59
+ line 631, in exec_module
60
+
61
+ exec(bytecode, module.__dict__)
62
+
63
+ File "lib\site-packages\scipy\sparse\linalg\__init__.py", line 114, in <module
64
+
65
+ >
66
+
67
+ File "c:\venv\ins\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
68
+
69
+ line 631, in exec_module
70
+
71
+ exec(bytecode, module.__dict__)
72
+
73
+ File "lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6, in <m
74
+
75
+ odule>
76
+
77
+ File "c:\venv\ins\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
78
+
79
+ line 631, in exec_module
80
+
81
+ exec(bytecode, module.__dict__)
82
+
83
+ File "lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 7, in <
84
+
85
+ module>
86
+
87
+ File "c:\venv\ins\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
88
+
89
+ line 714, in load_module
90
+
91
+ module = loader.load_module(fullname)
92
+
13
- Pyinstallerでexe化は出来たが、Pandasとsklearnのモジュールが読み込めていない
93
+ ImportError: DLL load failed: 指定されたモジュールが見つかりません
94
+
95
+ [11720] Failed to execute script SimplePred01
14
96
 
15
97
 
16
98
 
17
99
  ### 該当のソースコード
18
100
 
19
-
101
+ Pyinstallerでexe化するときに使用したspecファイルの中身。
102
+
20
-
103
+ 他ブログ等を参考にして、pandasは読み込んだが、sklearnを読み込んでいないっぽい。
104
+
105
+
106
+
21
-
107
+ # -*- mode: python -*-
108
+
109
+
110
+
111
+ block_cipher = None
112
+
113
+
114
+
115
+ himports = [
116
+
117
+ 'pandas', 'sklearn']
118
+
119
+
120
+
121
+ def get_pandas_path():
122
+
123
+ import pandas
124
+
125
+ pandas_path = pandas.__path__[0]
126
+
127
+ return pandas_path
128
+
129
+
130
+
131
+ def get_sklearn_path():
132
+
133
+ import sklearn
134
+
135
+ sklearn_path = sklearn.__path__[0]
136
+
137
+ return sklearn_path
138
+
139
+
140
+
141
+ a = Analysis(['SimplePred01.py'],
142
+
143
+ pathex=['C:\Users\z05464p0\Python\F_test02\make_exe'],
144
+
145
+ binaries=[],
146
+
147
+ datas=[],
148
+
149
+ hiddenimports=[],
150
+
151
+ hookspath=[],
152
+
153
+ runtime_hooks=[],
154
+
155
+ excludes=[],
156
+
157
+ win_no_prefer_redirects=False,
158
+
159
+ win_private_assemblies=False,
160
+
161
+ cipher=block_cipher)
162
+
163
+
164
+
165
+ dict_tree = Tree(get_pandas_path(), prefix='pandas', excludes=["*.pyc"])
166
+
167
+ a.datas += dict_tree
168
+
169
+ a.binaries = filter(lambda x: 'pandas' not in x[0], a.binaries)
170
+
171
+
172
+
173
+ dict_tree = Tree(get_sklearn_path(), prefix='sklearn', excludes=["*.pyc"])
174
+
175
+ a.datas += dict_tree
176
+
177
+ a.binaries = filter(lambda x: 'sklearn' not in x[0], a.binaries)
178
+
179
+
180
+
181
+ pyz = PYZ(a.pure, a.zipped_data,
182
+
183
+ cipher=block_cipher)
184
+
185
+ exe = EXE(pyz,
186
+
187
+ a.scripts,
188
+
189
+ exclude_binaries=True,
190
+
191
+ name='SimplePred01',
192
+
193
+ debug=False,
194
+
195
+ strip=False,
196
+
197
+ upx=True,
198
+
199
+ console=True )
200
+
201
+ coll = COLLECT(exe,
202
+
203
+ a.binaries,
204
+
205
+ a.zipfiles,
206
+
207
+ a.datas,
208
+
209
+ strip=False,
210
+
211
+ upx=True,
212
+
213
+ name='SimplePred01')
22
214
 
23
215
 
24
216
 

1

誤字修正

2018/03/16 06:03

投稿

miyakazu
miyakazu

スコア7

test CHANGED
File without changes
test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- Python3.6のsklearnを使用しようして簡単な重回帰分析を行うプログラムをexeで動かしたい。
5
+ Python3.6のsklearnを使用して簡単な重回帰分析を行うプログラムをexeで動かしたい。
6
6
 
7
7
 
8
8