安装conda
Anconda下载与安装
在Anconda官网下载python3.7版本
TensorFlow安装
打开Anconda Prompt
创建conda虚拟环境
用create -n 新建一个名叫TF2.1的环境用python3.7版本
conda create -n TF2.1 python=3.7
进入tensorflow2.1环境
conda activate TF2.1
安装英伟达的SDK10.1版本
conda install cudatoolkit=10.1
安装英伟达深度学习软件包7.6版本
conda install cudnn=7.6
如果你的GPU不支持英伟达,可以直接跳过上面两步,直接安装TensorFlow
安装TensorFlow
用pip install tensorflow==2.1指定2.1版本
安装完成后进入python环境验证是否安装成功
控制台输入python
import tensorflow as tf
查看TensorFlow版本
tf.__version__
如果显示2.1.0说明安装成功了
PyCharm下载与安装
安装按步骤进行
创建一个新项目
选用默认路径
设置工程路径
设置环境变量
使用刚刚配置好的conda环境
选择刚刚配置的TF2.1作为python解释器
如果网络不好的话,建议添加如下清华镜像再尝试
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/peterjc123/
conda config --set show_channel_urls yes