先来看看安装Scikit-learn 要求:
Python (>= 3.5),
NumPy (>= 1.11.0),
SciPy (>= 0.17.0),
joblib (>= 0.11).
一、安装numpy
安装 NumPy 最简单的方法就是使用 pip 工具:
pip3 install --user numpy scipy matplotlib
–user 选项可以设置只安装在当前的用户下,而不是写入到系统目录。
默认情况使用国外线路,国外太慢,我们使用清华的镜像就可以:
pip3 install numpy scipy matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple
但是我的Read timed out.等erro出现
安装库文件出现这个问题是pip的超时引起的。
下面是解决方法:
首先,需要在命令提示符(cmd)中进入到自己平时建立的python工程文件路径(或者python源文件安装的库路径)
接着在cmd命令提示符中输入“pip install --default-timeout=100 https://pypi.tuna.tsinghua.edu.cn/simple numpy==1.20
”
有些小伙伴通过这种方式既可以解决。
而我的又报不能解包,
更换国内的豆瓣镜像
pip install --default-timeout=100 -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com/simple numpy==1.20.0
各种报错最后搞定
二、安装SciPy 5种方法,3种成功
① pip install SciPy
同样 Read timed out
在官网找到 Installing via pip:
②
python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
还是 Read timed out
③pip install --default-timeout=100 SciPy==1.6.2
等待一万年,成功
④换阿里云镜像安装,老快了
pip install -i http://mirrors.aliyun.com/pypi/simple scipy --trusted-host mirrors.aliyun.com
④打开网址:https://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
cp37表示Python37版本,amd64是电脑64个字节
安装scipy‑1.6.2‑cp37‑cp37m‑win_amd64.whl,下载好存在python的scripts文件下,然后在cmd中输入:
pip install scipy‑1.6.2‑cp37‑cp37m‑win_amd64.whl
报错:
ERROR: scipy-1.6.2-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform.
可能是版本不适,已经成功了,就不想再跳这个坑了。
三、安装joblib
pip install joblib
一路顺风
检查:
Boss:安装Scikit-learn
pip install -U scikit-learn
It’s over