这里采用的是TensorFlow2.3.1 cuda10.1 和 cudnn7.6.5
1、安装Python
2、安装TensorFlow
- 打开终端(按下win+R)输入cmd
- 在终端输入(pip3 install –user –upgrade tensorflow)
安装CPU版TensorFlow
- 建议反向升级(pip3 install tensorflow==2.0.0)
3、安装CUDA10.1和cuDNN7.6.5
4、Vscode和环境配置路径
- 在插件中安装Python插件
- 新建一个.py文件
- 按住Ctrl +shift + p 输入(Select interpreter)
- 选择下图

测试文件
import tensorflow as tf
tf.__version__
返回版本型号(2.3.1)
tf.test.is_gpu_available()
返回(ture)
补充
- 安装OpenCV
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
- 安装matplotlib notebook numpy pandas sklearn
pip3 install numpy pandas sklearn matplotlib notebook -i https://pypi.douban.com/simple/
Jupyter notebook 自动联想
- 安装nbextensions:
pip install jupyter_contrib_nbextensions
- 安装nbextensions_configurator:
pip install jupyter_nbextensions_configurator
- 安装完成后进入Jupyter notebook
- 主页面选择Nbextensions
- 勾选 Hinterland
- 更换 Jupyter notebook 黑色背景
pip3 install jupyterthemes
pip3 install --upgrade jupyterthemes
jt -t monokai -f fira -fs 13 -cellw 90% -ofs 11 -dfs 11 -T -N