【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【Tensorflow 01】安装 Tensorflow 过程及遇到的问题_第1张图片

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

【Tensorflow 01】安装 Tensorflow 过程及遇到的问题_第2张图片

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.

【Tensorflow 01】安装 Tensorflow 过程及遇到的问题_第3张图片

你可能感兴趣的:(Tensorflow,tensorflow,深度学习,人工智能)