python numpy 欧氏距离 import numpy as np a1 = np.arange(5) print(a1) [0 1 2 3 4] a2 = np.arange(5,10) print(a2) [5 6 7 8 9] np.sqrt(np.sum(np.square(a2 - a1))) # 欧氏距离 11.180339887498949 np.linalg.norm(a2 - a1) # 欧氏距离 11.180339887498949