【Tensorflow 01】安装 Tensorflow 过程及遇到的问题

目录

1. 打开 anoconda prompt

2. 执行 pip install tensorflow

3. 执行 conda activate tensorflow

4. 执行 pip install tensorflow

5. 官网的命令也执行一遍。

6. 必须选择tensorflow环境,没有就加,参考下面截图路径。 

7. 测试下面代码。 

8.  千万不要把文件名写成 tensorflow.py 会报错!

9. 报下面的错:大概是因为我电脑用不了cuda


1. 打开 anoconda prompt

2. 执行 pip install tensorflow

3. 执行 conda activate tensorflow

4. 执行 pip install tensorflow

        不要问我为什么再来一遍,装就对了。

5. 官网的命令也执行一遍。

TensorFlow了解如何在您的系统上安装 TensorFlow。下载 pip 软件包,在 Docker 容器中运行或从源代码构建。在支持的卡上启用 GPU。https://tensorflow.google.cn/install

6. 必须选择tensorflow环境,没有就加,参考下面截图路径。 

7. 测试下面代码。 

# 作者:要努力,努力,再努力
# 开发时间:2022/5/3 23:07
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
hello = tf.constant("hello,tensorflow")
sess = tf.compat.v1.Session()
print(sess.run(hello))

8.  千万不要把文件名写成 tensorflow.py 会报错!

AttributeError: partially initialized module 'tensorflow' has no attribute 'compat' (most likely due to a circular import)

9. 报下面的错:大概是因为我电脑用不了cuda

2022-05-04 09:22:33.514123: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-05-04 09:22:33.514385: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2022-05-04 09:22:48.631023: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2022-05-04 09:22:48.632016: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)
2022-05-04 09:22:48.643423: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: LAPTOP-CU62MPM9
2022-05-04 09:22:48.644139: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: LAPTOP-CU62MPM9
2022-05-04 09:22:48.644888: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

不菜不菜

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值