前言:
在学习机器学习时,一般都会使用Anaconda。
Anaconda是一个强大的开源数据科学平台,它将很多好的工具整合在一起,极大地简化了使用者的工作流程,并能够帮助使用者解决一系列数据科学难题。
登录Anaconda官网。
- 进去是这样的,直接点击"Download"即可。(必须要是Windows环境且是64位)
安装详细步骤
- 双击下载好的安装包
- 点击next
- 点击I agree
- 选择All Users
- 选择安装路径,一定不要选C盘
- 只选择第二项,后期需要手动添加环境变量
- 点击Install 安装需要一些时间
- 点击next
- 对于2个learn 都取消
- 安装完成,手动添加环境变量
添加环境变量
在系统变量中,找到并点击Path在编辑环境变量中,点击新建
输入下面的五个环境变量。(这里不是完全一样的!你需要将以下五条环境变量中涉及的到的"D:\WorkSoftware\Install\Anaconda3"都修改为你的Anaconda的安装路径)
D:\WorkSoftware\Install\Anaconda3
D:\WorkSoftware\Install\Anaconda3\Scripts
D:\WorkSoftware\Install\Anaconda3\Library\bin
D:\WorkSoftware\Install\Anaconda3\Library\mingw-w64\bin
D:\WorkSoftware\Install\Anaconda3\Library\usr\bin
新建完成后,点击确定
检验安装是否成功
同时按 win + r ,输入cmd,在弹出的命令行查看anaconda版本,输入 :
conda --version
输入:
python
若出现版本号,即表示配置成功
更改conda源(后续安装第三方库可以加快速度)
使用
conda install 包名
安装需要的Python包非常方便,但是官方服务器在国外,下载龟速,国内清华大学提供了Anaconda的镜像仓库,我们把源改为 清华大学镜像源
在Anaconda prompt中操作:
在命令行输入以下命令,即可
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
//设置搜索时显示通道地址
conda config --set show_channel_urls yes
查看是否修改好通道:
conda config --show channels
恢复默认源
conda config --remove-key channels
删除旧镜像源
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/
添加新镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/