首页 笔记 图片 查字 
所属分类:null
浏览:107
内容:

给出主要的安装过程:


1、

下载anaconda最新版的

https://www.anaconda.com/products/distribution#Downloads

2、

执行exe文件


3、

在开始菜单

点击 Anaconda Prompt(Anaconda3)

进入 

(base) C:Userslenovo>

执行命令

(base) C:Userslenovo>  conda env list 


4、

使用命令conda create -n tensorflow python=3.7然后新建一个名为tensorflow的虚拟环境

(base) C:Userslenovo> conda create -n tensorflow python=3.9 

****耐心等待执行结束****


5、

上一步完成后,进入TensorFlow环境

(base) C:Userslenovo> activate tensorflow

(tensorflow) C:Userslenovo> 


6、

安装最新版TensorFlow

(tensorflow) C:Userslenovo>  pip install tensorflow


7、

检查是否安装成功

(tensorflow) C:Userslenovo>  python

Python 3.9.12 (main, Apr  4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32

Type "help", "copyright", "credits" or "license" for more information.

>>>

>>> import  tensorflow  as tf


>>> print(tf.__version__)

2.8.0

>>>

>>>


****安装成功****



8、

异常:缺少的windows dll文件,主要是GPU要用到的。 

cudart64_110.dll、nvcuda.dll

下载文件放入windows系统目录


>>> import  tensorflow  as tf

2022-04-09 19:24:59.573250: 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-04-09 19:24:59.574746: 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.

>>>


>>> hello = tf.constant('hello, tensorflow')

2022-04-09 19:35:37.180850: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found

2022-04-09 19:35:37.181052: W tensorflow/stream_executor/cuda/cuda_driver.cc:269] failed call to cuInit: UNKNOWN ERROR (303)

2022-04-09 19:35:37.190534: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-5A4P6CS

2022-04-09 19:35:37.190969: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-5A4P6CS

2022-04-09 19:35:37.191730: 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.

>>>