Autodl安装tensorflow2.10.0记录

首先租用新实例(我选的是3080*2卡),由于基础镜像中没有2.10.0版本,选miniconda3的基础环境

  • 创建虚拟环境:conda create --name xxx python=3.8(环境名)
  • 激活虚拟环境:conda activate xxx
  • 我的cuda版本11.3 cudnn版本8.2.0
  • 检查cuda版本nvcc --version
  • 检查cudnn版本dpkg-query -l | grep libcudnn

>>pip install tensorflow-gpu==2.10

  • 完成安装后检查版本信息(依次输入以下代码)
python 复制代码
>>python

>>import tensorflow as tf

>>tf.__version__(注意是两条小短杠)
2.10

>>print(tf.test.is_gpu_available())
True

>>print("Available GPUs:", tf.config.list_physical_devices('GPU'))
Available GPUs: [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]#显示可用的gpu,,如果显示Available GPUs: []就是没检测到可用的gpu

输出对应版本信息和True才安装成功

exit()退出

==================我是分割线============

①在Noteb0ook里进行测试

②可以看到和前面差不多的版本信息以及可用的gpu数量

python 复制代码
import tensorflow as tf

print(tf.__version__)
print(tf.test.gpu_device_name())
print(tf.config.experimental.set_visible_devices)
print('GPU:', tf.config.list_physical_devices('GPU'))
print('CPU:', tf.config.list_physical_devices(device_type='CPU'))
print(tf.config.list_physical_devices('GPU'))
print(tf.test.is_gpu_available())
# 输出可用的GPU数量
print("Num GPUs Available: ", len(tf.config.experimental.list_physical_devices('GPU')))

同样可以看得到版本信息

==================我是分割线============

  • 小测试:(依次输入)

python

import tensorflow as tf

hello = tf.constant('Hello, TensorFlow!')

print(hello.numpy())

输出:b'Hello, TensorFlow!'

==================我是分割线============

出问题大概是驱动程序、CUDA 库、TensorFlow 版本或环境配置的冲突导致,我一般选择更改tensorflow版本

我的经验是gpt比百度别人的经验靠谱,别人成功了,一样的代码 自己的环境下不一定成功。安装环境就是玄学。

相关推荐
我是大聪明.2 分钟前
DeepSeek V4 Pro + 华为昇腾910:国产大模型落地的性能实测与深度解析
人工智能·华为
2301_8009769314 分钟前
正则表达式
开发语言·python·正则表达式
机器之心19 分钟前
Generalist之后,罗剑岚团队推出LWD,也要变革具身智能训练范式
人工智能·openai
IT_陈寒24 分钟前
Vite的public文件夹放静态资源?这坑我替你踩了
前端·人工智能·后端
传说故事24 分钟前
【论文阅读】Diffusion Forcing: Next-token Prediction Meets Full-Sequence Diffusion
论文阅读·人工智能·diffusion
码界奇点27 分钟前
基于Python的新浪微博数据爬虫系统设计与实现
数据库·爬虫·python·毕业设计·新浪微博·源代码管理
xixixi7777728 分钟前
三重筑基:5G-A超级上行提速千兆,电联低频共享扫平盲点,800V HVDC算电协同破局
人工智能·5g·ai·大模型·算力·通信·信通院
jkyy201429 分钟前
AI运动数字化:以技术重塑场景,健康有益赋能全域运动健康管理
大数据·人工智能·健康医疗
金融小师妹37 分钟前
4月30日多因子共振节点:鲍威尔“收官效应”与权力结构重塑的预期重构
大数据·人工智能·重构·逻辑回归
2601_9499251842 分钟前
AI Agent如何重构跨境物流的决策?
大数据·人工智能·重构·ai agent·geo优化·物流科技