centos7 是阿里云个人服务的系统,用xshell链接进行操作
安装pip,如果已经安装可跳过此步骤
wget http://python-distribute.org/distribute_setup.py
python distribute_setup.py
wget https://github.com/pypa/pip/raw/master/contrib/get-pip.py
python get-pip.py
安装numpy
pip install numpy
安装scipy
pip install scipy
安装scikit-learn
pip install -U scikit-learn
输出如下提示即表示成功
Installing collected packages: scikit-learn
Successfully installed scikit-learn-0.19.1
进行测试,新建python文件,输入以下代码 并保存
from sklearn import svm
x = [[0, 0], [1, 1]]
y = [0, 1]
clf = svm.SVC()
clf.fit(x, y)
ans = clf.predict([[2., 2.]])
print(ans)
运行上述代码结果如下:
[1]

本文指导如何在CentOS7系统上,通过xshell连接,一步步安装pip、numpy、scipy以及scikit-learn。成功安装后,通过创建并运行Python文件验证scikit-learn的安装效果。
1763

被折叠的 条评论
为什么被折叠?



