pip 安装 sklearn or scikit-learn python3

pip 安装 sklearn or scikit-learn python3,第1张

安装 sklearn
1. 安装 numpy  scipy  matplot

$ pip3 install numpy scipy matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple

2. 安装 sklearn

$ pip3 install scikit-learn -i https://pypi.tuna.tsinghua.edu.cn/simple

只为当前用户安装:

 $ pip3 install --user  scikit-learn -i https://pypi.tuna.tsinghua.edu.cn/simple


 
 安装ipython

$ sudo apt install ipython3

试一下 sklearn加载数据:

$ ipython3

In [1]: from sklearn import *
In [2]: datasets
Out[2]: 
In [9]: iris =  datasets.load_iris()

In [10]: iris.data
Out[10]:
array([[5.1, 3.5, 1.4, 0.2],
  
。。。

In [11]: iris.target

In [12]: iris.DESCR

In [13]: iris.feature_names
Out[13]:
['sepal length (cm)',
 'sepal width (cm)',
 'petal length (cm)',
 'petal width (cm)']

In [14]: iris.target
Out[14]:
array([0, 0, 0, 0, 0, 


 
 ----------------------------------------------------------------------------------------------
 显示信息:
   Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c1/1a/c7557d40fc0f94aa589fed98196dac67b030fda63e1b3ea2f269351cc409/kiwisolver-1.4.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.2 MB)
     |████████████████████████████████| 1.2 MB 460 kB/s
Installing collected packages: numpy, scipy, cycler, pyparsing, packaging, fonttools, kiwisolver, matplotlib
  WARNING: The scripts f2py, f2py3 and f2py3.8 are installed in '/home/opencl/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts fonttools, pyftmerge, pyftsubset and ttx are installed in '/home/opencl/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed cycler-0.11.0 fonttools-4.33.3 kiwisolver-1.4.2 matplotlib-3.5.2 numpy-1.22.3 packaging-21.3 pyparsing-3.0.8 scipy-1.8.0
opencl@opencl-PC:~/ex/scikit-learn$

----------------------------------------------------------------------------------------------

numpy 学习网站:
https://www.runoob.com/numpy/numpy-install.html

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/915508.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-16
下一篇 2022-05-16

发表评论

登录后才能评论

评论列表(0条)

保存