栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Anaconda+pythorch 安装及使用

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Anaconda+pythorch 安装及使用

1.安装anaconda
  • 下载安装包

https://www.anaconda.com/https://www.anaconda.com/https://www.anaconda.com/

tips:若官网下载速度慢,可以使用清华镜像站下载:

https://mirrors.tuna.tsinghua.edu.cn/https://mirrors.tuna.tsinghua.edu.cn/https://mirrors.tuna.tsinghua.edu.cn/

  • 安装

普通用户

bash Anaconda3-2021.05-Linux-x86_64.sh

root用户

sudo bash Anaconda3-2021.05-Linux-x86_64.sh

将conda加入环境变量(普通用户)

echo 'export PATH="/home/anaconda3/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

若安装到root用户时,需先切换到root

sudo su
 2.conda 基本使用
$ conda-env list //查看虚拟环境
$ conda create -n name python=3.7 //创建一个虚拟环境
$ conda activate name //启动虚拟环境
$ conda deactivate //关闭虚拟环境
$ conda remove -n nlp --all //删除虚拟环境
3.安装pythorch
#添加清华源,国外源速度慢
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/main/
conda config --set show_channel_urls yes
conda upgrade --all
#检查源添加是否成功,也可在Anaconda Navigator中查看channels
conda config --set show_channel_urls yes  
#安装pytorch(cpu版),torchvision
conda install pytorch-cpu torchvision-cpu -c pytorch

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/349784.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号