Windows安装minconda+python+jupyter++torch+torchvision+d2l案例分享(亲测有效)

1、安装miniconda,在官网选择合适的版本,下载安装,注意选择加入环境变量:

2、进入conda环境,安装所需软件包

2.1 创建一个conda环境

conda create --name d2l-zh

激活环境:conda activate d2l-zh

2.2 导入国内软件包源地址

Windows 用户无法直接创建名为 .condarc 的文件,可先执行

 conda config --set show_channel_urls yes 

生成该文件。生成的文件在C:\Users\用户名\.condarc

在命令行下执行以下语句:

# 中科大镜像源

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/

conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/

# 北京外国语大学源

conda config --add channels  https://mirrors.bfsu.edu.cn/anaconda/pkgs/main

conda config --add channels  https://mirrors.bfsu.edu.cn/anaconda/pkgs/free

conda config --add channels  https://mirrors.bfsu.edu.cn/anaconda/pkgs/r

conda config --add channels  https://mirrors.bfsu.edu.cn/anaconda/pkgs/pro

conda config --add channels  https://mirrors.bfsu.edu.cn/anaconda/pkgs/msys2

#清华源

conda config --add channels  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main

conda config --add channels  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free

conda config --add channels  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r

conda config --add channels  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro

conda config --add channels  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2

2.3 安装 python:

Conda install python=3.8

如果发现Python 3.x版本与TensorFlowOpenCVVS2015等不兼容,可以安装其他python版本

conda install python=3.5(ps:这个没试过)

这个命令将用3.5覆盖conda中的Python版本。这样做修正了我面临的大部分错误。

2.4 接下来安装这些包(基于李沐的课程所需程序包)

早上网速超赞,安装torch 和torchvision超快!总算运行成功了!

2.5  Jupyter notebook安装扩展插件

(1)安装Jupyter Notebook

pip install jupyter

(2)安装Jypyter Notebook扩展包

pip install jupyter_contrib_nbextensions

jupyter contrib nbextension install --user

(3)启动Jupyter Notebook

jupyter notebook

在浏览器中输入http://localhost:8888/,进入notebook首页,会发现菜单栏中多了一个Nbextensions,如下图所示。

https://images2018.cnblogs.com/blog/323808/201808/323808-20180818173012477-190403022.png

然后就可以看到茫茫多的插件了。

2.6 激活conda环境python的方法

从cmd进入conda环境,并激活conda环境python:

环境终于ok了,机器学习的课程整起来!

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值