安装scikit-learn/sklearn并验证安装成功


一、安装

  • 打开命令行,并进入环境

通过conda进行安装,会检查当前环境下所有包之间的依赖关系
通过pip进行安装,并没有考虑现有的包,可能会出现安装也不能工作的情况(但很少出现)
一般情况下,pip安装比conda安装更快

1. conda安装

## 添加可用源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

## 显示源(安装包时显示channel的url,由此可知包的安装来源)
conda config --set show_channel_urls yes

## 安装scikit-learn
conda update scikit-learn

2. pip安装

## 指定源安装
pip install scikit-learn -i https://pypi.tuna.tsinghua.edu.cn/simple

二、验证

  • 进入python
import sklearn
sklearn.__version__

猜你喜欢

转载自blog.csdn.net/qq_43377653/article/details/127580666
今日推荐