创建虚拟环境
conda create -n your_env_name python=x.x
conda create -n tf_cpu python=3.6
python版本参考如下
https://www.tensorflow.org/install/pip?hl=zh-cn
初始化
conda init
关闭命令框再重新打开
标题
conda activate tf_cpu
升级pip版本,如果版本不满足要求
python -m pip install --upgrade pip
安装cpu版本tf
pip install --upgrade tensorflow
pip install --upgrade tensorflow
安装gpu需要的CUDA、cudnn
命令行输入python
再按照以下步骤查看tensorflow版本,对应安装cuda,cudnn
nvidia-smi 查看cuda等版本
根据自己的版本情况安装
conda install cudatoolkit=11.2 -c conda-forge
conda install cudnn=8.1 -c conda-forge
其中use -c conda-forge for newest installs,不然conda找不到最新版本