Anaconda安装Tensorflow

1、删除原有的tensorflow

通过conda list命令查看tensorflow安装的版本
在这里插入图片描述
conda命令行中输入

pip uninstall tensorflow==2.17.0

2、安装tensorflow

url:https://github.com/tensorflow/tensorflow
tensoflow在github上直接给出的安装方式

pip install tensorflow
pip install tensorflow-cpu #CPU版

3、检验是否安装成功

方式一(github官方)

import tensorflow as tf
tf.add(1, 2).numpy()
hello = tf.constant('Hello, TensorFlow!')
hello.numpy()

在这里插入图片描述

方式二

from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())

在这里插入图片描述
上述方式表明安装为CPU版,若安装为GPU版会显示“GPU”

(⚠️Tips:安装GPU版应该需要提前安装好CUDA Toolkit+cuDNN,后续有需要再安装)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值