使用Cython接口在时间试验中运行几何级数的迭代循环。
在编译时出现错误(shift-enter):CompileError:命令“gcc”以1的退出状态失败
%load_ext Cython
%%cython
def geo_prog_cython(double alpha, int n):
cdef double current = 1.0
cdef double sum = current
cdef int i
for i in range(n):
current = current * alpha
sum = sum + current
return sum
错误:
//anaconda/lib/python3.5/distutils/command/build_ext.py in build_extension(self, ext)
530 debug=self.debug,
531 extra_postargs=extra_args,
--> 532 depends=ext.depends)
533
534 # XXX outdated variable, kept here in case third-part code
//anaconda/lib/python3.5/distutils/spawn.py in _spawn_posix(cmd, search_path, verbose, dry_run) 158 "命令 %r 执行失败,退出状态码为 %d" --> 159 % (cmd, exit_status)) 160 elif os.WIFSTOPPED(status):DistutilsExecError: 命令 'gcc' 执行失败,退出状态码为 1 - rrg