https://zhuanlan.zhihu.com/p/34730661
1. 安裝anaconda3:自行下載、安裝【注意版本】
(可參考引用鏈接)
2. 搭建TensorFlow環境
cuda10.1
cudnn10.1
opencv4.11
顯卡1050ti
win10
2.1 輸入清華庫,更新快一點:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_urls yes

2.2 在anaconda中創建TensorFlow環境
同樣在Anaconda Prompt中利用Anaconda創建一個python3.5的環境,環境名稱為tensorflow ,輸入下面命令:
3 開始安裝
pip install --ignore-installed --upgrade tensorflow-gpu
cuda關系對應表
https://blog.csdn.net/omodao1/article/details/83241074
安裝tf2.0- python3.6-cuda10.0 不是10.1
pip install tensorflow-gpu==2.0
安裝tf1.4- python3.6-cuda8.0-cudnn6-numpy1.16
pip install tensorflow-gpu==1.4
測試程序
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
sys.path.append("F:/dongdong/0tool/python/anaconda3/envs/work_cuda8_py36_tf14/Lib/site-packages")
import numpy
import tensorflow as tf
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
c = tf.matmul(a, b)
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
print(sess.run(c))

報錯兩個
1 安裝werkzeug

2 安裝cypthon庫

3問題 里可以發現你可能安裝了兩個numpy,所以會報錯
我通過從numpy卸載當前版本並通過重新安裝最新版本來解決。pip uninstall numpy
和
pip install numpy
python -m pip install --upgrade numpy
4問題 cuda不對。 10.0和10.1都不行???

您應該安裝Cuda 10.0。如果您安裝了Cuda 10.1,將沒有文件cudart64_100.dll。我重命名cudart64_101.dll為cudart64_100.dll,可以正常工作。

5 Tensorflow 2.0 - AttributeError: module 'tensorflow' has no attribute 'Session'
pip install --upgrade pip pip install tensorflow==2.0.0-alpha0 pip install keras pip install numpy==1.16.2
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
sys.path.append("F:/dongdong/0tool/python/anaconda3/envs/work_py36/Lib/site-packages")
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
sess.run(hello)
a = tf.constant(10)
b = tf.constant(32)
sess.run(a+b)
成功了

