0
這是numbaNumba: '模塊' 對象沒有屬性 'global_variables'
import numpy as np
from numba import double
from numba.decorators import jit, autojit
X = np.random.random((1000, 3))
def pairwise_python(X):
M = X.shape[0]
N = X.shape[1]
D = np.empty((M, M), dtype=np.float)
for i in range(M):
for j in range(M):
d = 0.0
for k in range(N):
tmp = X[i, k] - X[j, k]
d += tmp*tmp
D[i, j] = np.sqrt(d)
return D
pairwise_numba = autojit(pairwise_python)
pairwise_numba(X)
的一個基本的例子,但它產生的錯誤消息
AttributeError: Failed at object (object mode frontend)
Failed at object (object mode backend)
'Module' object has no attribute 'global_variables'
我的康達版本是
numba 0.18.2 np19py27_1
numbapro 0.18.0 np19py27_p2
llvmlite 0.4.0 py27_0
你有同樣的問題嗎?幫幫我..
這可能是一個兼容性問題 - 請參閱這個線程:https://github.com/numba/numba/issues/992 –