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

个人记录-2022.4.27-给3090,ubuntu20.04配置深度学习环境

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

个人记录-2022.4.27-给3090,ubuntu20.04配置深度学习环境

参考教程(实际操作时略有不同):
1

2

3

在老师电脑上的版本说明:
在conda下新建了名为tf-gpu的虚拟环境
python 3.9
tensorflow-gpu 2.5.0
cudatoolkit 11.3.1
cudnn 8.2.1
keras 2.5.0

实际操作命令行记录:
#查看显卡信息,发现系统未检测到显卡
nvidia-smi
lshw -c video

#查看对应的显卡驱动版本并安装
sudo apt-get --purge remove nvidia*
sudo apt autoremove
ubuntu-drivers devices
sudo apt install nvidia-driver-510-server

#重启电脑

#创建conda虚拟环境tf-gpu
python
conda create -n tf-gpu python==3.9
conda info -e

#激活虚拟环境tf-gpu
source activate tf-gpu
conda list

#输入以下命令打开condarc文件
vi ~/.condarc

#然后输入以下内容
该方法参考自清华源anaconda

channels:

  • defaults
    show_channel_urls: true
    default_channels:
  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  • https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
    custom_channels:
    conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
    simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

#然后在tf-gpu该虚拟环境中安装库
source activate tf-gpu
conda install cudatoolkit=11.3 cudnn=8.2.1

#这里选择清华、阿里镜像源,或不选择源直接安装,网速较快(以下三种命令选其一即可)
pip install --default-time=300 tensoflow-gpu2.5.0 keras2.5.0rc0 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install --default-time=300 tensorflow-gpu2.5.0 keras2.5.0rc0 -i https://mirrors.aliyun.com/pypi/simple
pip install --default-time=300 tensorflow-gpu2.5.0 keras2.5.0rc0

#在终端输入以下命令行验证
source activate tf-gpu
python
import tensorflow as tf
print(tf.version,tf.test.is_gpu_available())

#显示结果为2.5.0 True,安装成功

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

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

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