Fall-back from the nopython compilation path to the object mode compilation

出现此提示的原因是用@jit标注的函数内存在非数值运算语句。

比如下例中,time()函数和print()函数都不能出现在foo()函数中。正确写法为:

1
2
3
4
5
6
7
8
9
10
11
12
13
import numba as nb
import time
 
@nb.jit
def foo(x, y):
	s = 0
	for i in range(x, y):
		s += i
	return s
 
tt = time.time()
print(foo(1, 100000000))
print('Time used: {} secs'.format(time.time() - tt))