这个python代码
import numpy as np
from scipy.spatial.distance import euclidean
a = np.array([5,3,4,-1,0]);
b = np.array([2,4,0,-5,-2]);
dist = euclidean(a,b);
print ("Distancia = "+ str(dist) );
simil = 1/(1+dist);
print ('Similitud = '+ str(simil) );
在没有问题的spyder运行中但在pycharm中我收到此错误消息
/home/user/anaconda3/envs/prueba2/bin/python /home/user/PycharmProjects/prueba2/prueba2.py
Traceback (most recent call last):
File "/home/user/PycharmProjects/prueba2/prueba2.py", line 1, in <module>
import numpy as np
ModuleNotFoundError: No module named 'numpy'
这是项目解释器
答案 0 :(得分:0)
pip3 install numpy
pip install numpy
在终端中使用上面的命令然后为python 3.6安装numpy 再试一次。