質問編集履歴

4

エラー内容の省略

2019/03/01 02:57

投稿

urao
urao

スコア10

test CHANGED
File without changes
test CHANGED
@@ -26,217 +26,13 @@
26
26
 
27
27
  ### 発生している問題・エラーメッセージ
28
28
 
29
-
30
-
31
29
  ```
32
-
33
- DistutilsExecError Traceback (most recent call last)
34
-
35
- ~/anaconda/lib/python3.6/distutils/unixccompiler.py in _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts)
36
-
37
- 117 self.spawn(compiler_so + cc_args + [src, '-o', obj] +
38
-
39
- --> 118 extra_postargs)
40
-
41
- 119 except DistutilsExecError as msg:
42
-
43
-
44
-
45
- ~/anaconda/lib/python3.6/distutils/ccompiler.py in spawn(self, cmd)
46
-
47
- 908 def spawn(self, cmd):
48
-
49
- --> 909 spawn(cmd, dry_run=self.dry_run)
50
-
51
- 910
52
-
53
-
54
-
55
- ~/anaconda/lib/python3.6/distutils/spawn.py in spawn(cmd, search_path, verbose, dry_run)
56
-
57
- 35 if os.name == 'posix':
58
-
59
- ---> 36 _spawn_posix(cmd, search_path, dry_run=dry_run)
60
-
61
- 37 elif os.name == 'nt':
62
-
63
-
64
-
65
- ~/anaconda/lib/python3.6/distutils/spawn.py in _spawn_posix(cmd, search_path, verbose, dry_run)
66
-
67
- 158 "command %r failed with exit status %d"
68
-
69
- --> 159 % (cmd, exit_status))
70
-
71
- 160 elif os.WIFSTOPPED(status):
72
-
73
-
74
-
75
- DistutilsExecError: command 'gcc' failed with exit status 1
76
-
77
-
78
-
79
- During handling of the above exception, another exception occurred:
80
-
81
-
82
-
83
- CompileError Traceback (most recent call last)
84
-
85
- <ipython-input-17-a5ddb4bc6ced> in <module>()
86
-
87
- ----> 1 get_ipython().run_cell_magic('cython', '', 'def cy_fib2(int n):\n a, b = 0.0, 1.0\n for i in range(n):\n a, b = a + b, a\n return a')
88
-
89
-
90
-
91
- ~/anaconda/lib/python3.6/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
92
-
93
- 2165 magic_arg_s = self.var_expand(line, stack_depth)
94
-
95
- 2166 with self.builtin_trap:
96
-
97
- -> 2167 result = fn(magic_arg_s, cell)
98
-
99
- 2168 return result
100
-
101
- 2169
102
-
103
-
104
-
105
- <decorator-gen-127> in cython(self, line, cell)
106
-
107
-
108
-
109
- ~/anaconda/lib/python3.6/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
110
-
111
- 185 # but it's overkill for just that one bit of state.
112
-
113
- 186 def magic_deco(arg):
114
-
115
- --> 187 call = lambda f, *a, **k: f(*a, **k)
116
-
117
- 188
118
-
119
- 189 if callable(arg):
120
-
121
-
122
-
123
- ~/anaconda/lib/python3.6/site-packages/Cython/Build/IpythonMagic.py in cython(self, line, cell)
124
-
125
- 327
126
-
127
- 328 self._build_extension(extension, lib_dir, pgo_step_name='use' if args.pgo else None,
128
-
129
- --> 329 quiet=args.quiet)
130
-
131
- 330
132
-
133
- 331 module = imp.load_dynamic(module_name, module_path)
134
-
135
-
136
-
137
- ~/anaconda/lib/python3.6/site-packages/Cython/Build/IpythonMagic.py in _build_extension(self, extension, lib_dir, temp_dir, pgo_step_name, quiet)
138
-
139
- 437 if not quiet:
140
-
141
- 438 old_threshold = distutils.log.set_threshold(distutils.log.DEBUG)
142
-
143
- --> 439 build_extension.run()
144
-
145
- 440 finally:
146
-
147
- 441 if not quiet and old_threshold is not None:
148
-
149
-
150
-
151
- ~/anaconda/lib/python3.6/distutils/command/build_ext.py in run(self)
152
-
153
- 337
154
-
155
- 338 # Now actually compile and link everything.
156
-
157
- --> 339 self.build_extensions()
158
-
159
- 340
160
-
161
- 341 def check_extensions_list(self, extensions):
162
-
163
-
164
-
165
- ~/anaconda/lib/python3.6/distutils/command/build_ext.py in build_extensions(self)
166
-
167
- 446 self._build_extensions_parallel()
168
-
169
- 447 else:
170
-
171
- --> 448 self._build_extensions_serial()
172
-
173
- 449
174
-
175
- 450 def _build_extensions_parallel(self):
176
-
177
-
178
-
179
- ~/anaconda/lib/python3.6/distutils/command/build_ext.py in _build_extensions_serial(self)
180
-
181
- 471 for ext in self.extensions:
182
-
183
- 472 with self._filter_build_errors(ext):
184
-
185
- --> 473 self.build_extension(ext)
186
-
187
- 474
188
-
189
- 475 @contextlib.contextmanager
190
-
191
-
192
-
193
- ~/anaconda/lib/python3.6/distutils/command/build_ext.py in build_extension(self, ext)
194
-
195
- 531 debug=self.debug,
196
-
197
- 532 extra_postargs=extra_args,
198
-
199
- --> 533 depends=ext.depends)
200
-
201
- 534
202
-
203
- 535 # XXX outdated variable, kept here in case third-part code
204
-
205
-
206
-
207
- ~/anaconda/lib/python3.6/distutils/ccompiler.py in compile(self, sources, output_dir, macros, include_dirs, debug, extra_preargs, extra_postargs, depends)
208
-
209
- 572 except KeyError:
210
-
211
- 573 continue
212
-
213
- --> 574 self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
214
-
215
- 575
216
-
217
- 576 # Return *all* object filenames, not just the ones we just built.
218
-
219
-
220
-
221
- ~/anaconda/lib/python3.6/distutils/unixccompiler.py in _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts)
222
-
223
- 118 extra_postargs)
224
-
225
- 119 except DistutilsExecError as msg:
226
-
227
- --> 120 raise CompileError(msg)
228
-
229
- 121
230
-
231
- 122 def create_static_lib(self, objects, output_libname,
232
-
233
-
234
30
 
235
31
  CompileError: command 'gcc' failed with exit status 1
236
32
 
237
33
  ```
238
34
 
239
-
35
+ というエラーが発生しています。
240
36
 
241
37
 
242
38
 

3

ソースコードの修正

2019/03/01 02:57

投稿

urao
urao

スコア10

test CHANGED
File without changes
test CHANGED
@@ -16,25 +16,7 @@
16
16
 
17
17
  ### 該当のソースコード
18
18
 
19
- %load_ext Cython
20
-
21
-
22
-
23
- %%cython
24
-
25
- def cy_fib2(int n): 
26
-
27
-  a, b = 0.0, 1.0
28
-
29
-   for i in range(n):
30
-
31
-    a, b = a + b, a
32
-
33
-
34
-
35
-  return a
36
-
37
- (ソースコードの貼り付けがうまくなかったため、画像で貼り付けます)
19
+ (ソースコードの貼り付けが、スペースがれられなかったので、画像で貼り付けます)
38
20
 
39
21
 
40
22
 

2

ソースコードの修正

2019/02/25 12:06

投稿

urao
urao

スコア10

test CHANGED
File without changes
test CHANGED
@@ -16,27 +16,29 @@
16
16
 
17
17
  ### 該当のソースコード
18
18
 
19
- ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
20
-
21
19
  %load_ext Cython
22
20
 
23
21
 
24
22
 
25
- %%cython
23
+ %%cython
26
-
24
+
27
- def cy_fib2(int n):
25
+ def cy_fib2(int n): 
28
26
 
29
27
   a, b = 0.0, 1.0
30
28
 
31
-  for i in range(n):
29
+   for i in range(n):
32
-
30
+
33
-   a, b = a + b, a
31
+    a, b = a + b, a
34
32
 
35
33
 
36
34
 
37
35
   return a
38
36
 
39
- ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
37
+ (ソースコードの貼り付けがうまくいかなかったため、画像でも貼り付けます)
38
+
39
+
40
+
41
+ ![イメージ説明](3b3ae5beb035d0937f0be5ae83addd97.png)
40
42
 
41
43
 
42
44
 

1

該当のソースコードの改行を修正

2019/02/25 11:54

投稿

urao
urao

スコア10

test CHANGED
File without changes
test CHANGED
@@ -26,13 +26,15 @@
26
26
 
27
27
  def cy_fib2(int n):
28
28
 
29
- a, b = 0.0, 1.0
29
+  a, b = 0.0, 1.0
30
-
30
+
31
- for i in range(n):
31
+  for i in range(n):
32
-
32
+
33
- a, b = a + b, a
33
+   a, b = a + b, a
34
-
34
+
35
+
36
+
35
- return a
37
+  return a
36
38
 
37
39
  ‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐‐
38
40