【GPU-Tensorflow/pytorch】linux/windows 哭泣终于好了

GPU-Tensorflow-linux


参考:
1.Linux conda中Tensorflow GPU安装配置全面梳理(包含cuda、cudnn)_gv102-CSDN博客
2. Tensorflow-GPU和sklearn的安装_怎么在tensorflow里面安装sklearn-CSDN博客

明明很简单但搞了半天 总结个有用的教程叭

  1. 确认GPU 显卡 lspci | grep -i vga 第一行是集成显卡,忽略
  2. 确定TensorFlow版本 python3.9对应的是2.6.0
  3. 创建环境
    1. conda create -n yourname python=3.9 # 创建虚拟环境,python选择3.9
    2. activate yourname -gpu # 激活虚拟环境
  4. 安装 conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0 (两个分开装可能报错 这个指令亲测有效)
  5. pip install matplotlib==3.5.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
  6. pip install numpy==1.19.5 -i https://pypi.tuna.tsinghua.edu.cn/simple
  7. pip install scikit-learn==0.24.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
  8. pip install tensorflow-gpu==2.6.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
  9. pip install protobuf==3.20.0 -i https://pypi.tuna.tsinghua.edu.cn/simple # protobuf需要满足版本大于3.19.6且不超过3.20.x
  10. pip install keras==2.6 -i https://pypi.tuna.tsinghua.edu.cn/simple
  11. 检测
 --coding: utf8--
import tensorflow as tf
if __name__ == '__main__': 
print('tf version: {}'.format(tf.__version__)) 
print('keras version: {}'.format(tf.keras.__version__))
# print('GPU: {}'.format(tf.test.is_gpu_available())) # 1.x版本的TF使用此行 
print('GPU: {}'.format(tf.config.list_physical_devices('GPU'))) # 2.x版本的TF使用 

GPU-pytorch-windows

Windows
成功解决:AssertionError: Torch not compiled with CUDA enabled-CSDN博客

其他

Linux安装Anaconda(Anaconda3-2022.10-Linux-x86_64.sh版本)-CSDN博客

24.01.07 | 计算机视觉博士生存指南(三) | 服务器配置与基础Linux指令大全 - 知乎 (zhihu.com)

vs
VSCode使用Remote SSH连接远程服务器 - 知乎 (zhihu.com)

  • 8
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值