随笔 - 1762  文章 - 0  评论 - 109  阅读 - 431万

ubuntu利用conda创建虚拟环境,并安装cuda,cudnn,pytorch

cd到安装包所在目录,安装:bash Anaconda3-5.1.0-Linux-x86_64.sh

创建虚拟环境:conda create -n your_env_name python=3.6
 

激活虚拟环境:source activate your_env_name

添加conda国内镜像:

  1. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  2. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  3. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
  4. conda config --set show_channel_urls yes

安装cuda:conda install cudatoolkit=9.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/
 

安装cudnn:conda install cudnn=7.4.1 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/

安装pytorch指定版本:conda install pytorch=0.3.0 torchvision=0.2.0 -c soumith

根据电脑环境,按照pytorch官网对应代码安装

torch官网:https://pytorch.org/get-started/locally/

 

 

注:

安装conda完成后,输入conda list,若出现未找到命令,则需修改环境变量:export PATH=~/anaconda3/bin:$PATH(此法每次开机后都要修改,也可修改配置文件永久生效)

每个不同镜像网站里面包含各种不同的下载包,可根据自己的需求打开查找对应的安装包,

如cudatoolkit 8.0.3 在https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/内,

则安装命令如:conda install cudatoolkit=8.0 -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/ 即可。

posted on   一杯明月  阅读(5275)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
历史上的今天:
2019-10-18 conda管理python环境
2019-10-18 python将数组写入文件
2019-10-18 神经网络中Batch Size的理解
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示