windows 下使用anaconda指南

news/2024/7/8 5:41:24

1 创建python 环境

我创建一个虚拟环境,名字为pytorch_gpu ,搭配的Python环境为 3.7,命令如下所示:

 conda create -n pytorch_gpu  python=3.7

2 查看都有哪些虚拟环境的指令:

 conda info --env

3 激活某个环境的指令

 conda activate pytorch_gpu

4 更改conda源为国内的源:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
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/pkgs/free/
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.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

conda config --set show_channel_urls yes

5 在一个环境中安装gpu版本的pytorch


conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=9.2 -c pytorch

6 anaconda总是存储太多包和文件,占用空间,可以使用下面的代码块删除不用的文件:

 conda clean -a

7 停止某个正在进行的环境

conda deactivate

 


http://www.niftyadmin.cn/n/3657585.html

相关文章

逆流和操作

原文:Contraflow and Operations我认为Bill de hOra的博客"逆流"是开发与操作之间的"缝隙"。很明显,我站在Bill和Steve一边---不要再把时间浪费在"另一个抽象工厂"系统和开始确定如何让这个东西运经济地运行起来&#xff…

pytorch中的手动设置图片标签的方式

如果想自己手动设置一些标签,可以使用下面的方式: import torchlabel torch.tensor([2,0,4,1,2]).long() 注意,一定要在后面加上.long()才行,因为标签是这个long型的数据

敏捷和大人物

原文:Agility and the Big Dog 今天,有人把这个链节发给我看,但是我并不赞同里面的所有内容,不过我喜欢后面的这段话:“校园内的大人物”应该对什么嚷嚷? 如果他们将OOP作为敏捷开发焦点的中心&#xff0c…

ubunut 安装apex

git clone https://github.com/NVIDIA/apex cd apex python3 setup.py install

model.load_state_dict(state_dict, strict=False)

我们在构造好了一个模型后,可能要加载一些训练好的模型参数。举例子如下: 假设 trained.pth 是一个训练好的网络的模型参数存储 model Net()是我们刚刚生成的一个新模型,我们希望model将trained.pth中的参数加载加载进来,但是…

新VB9出来了

原文:New VB9 available Amanda & Co 有新版编译器可供下载。它在DLINQ/选项中嵌入了XML,动态类型支持和对其功能。阅读相关信息,点击 这里。

VB9和Atom

原文: VB9 and Atom VB9和Atom我最近在试图说明C#所具有的高素养语言特点时,我的一大帮朋友都给我发来悲哀的信息。为了吸引我们中所有的软件蓝领,我想我应该用一小段VB9程序来清洗调色板,演示Erik & Co. 放在语言中对Xml的支…