在阿里云服务器配置tensorflow的gpu运行环境
unbuntu版本20.04 64位
GPU: NIVIDIA T4
anaconda版本:4.3.30
CUDA版本 11.0.207(创建实例时勾选)
- 搭建虚拟环境
conda create -n tf-gpu #创建名叫tf-gpu的虚拟环境 source activate tf-gpu #激活tf-gpu环境,激活成功能看见主机名左边从(base)基础环境变成了(tf-gpu)虚拟环境,后续的tensorflow-gpu以及其他库都会装在这个环境下,同时base环境的库需要重新安装 conda install tensorflow-gpu #给虚拟环境安装GPU版本的tensorflow,linux的兼容度很好,基本上安装最新版的就没问题,反而安装旧版本容易出错。 conda list -n tf-gpu #查看当前虚拟环境下都有那些库
- 安装程序需要的第三方库
- 将虚拟环境配置给ipython
conda install cudatoolkit conda install ipykernel #给ipython配置核心 conda install -n tf-gpu ipyker #把tf-gpu python -m ipykernel install --user --name tf-gpu --display-name "tf-gpu" #notebook配置tf-gpu环境
conda install cudatoolkit
conda install ipykernel
conda install -n tf-gpu ipyker
python -m ipykernel install --user --name tf-gpu --display-name "tf-gpu"#notebook配置tf-gpu环境
- 配置nvidia驱动
ubuntu-drivers devices #查找可用的驱动文件版本 cat /proc/driver/nvidia/version #查看本机的驱动版本 sudo apt-get install nvidia-driver-440 #装一个比本机驱动版本大的驱动
- 更新tensorflow和tensorflow-gpu的版本
Cannot uninstall six. It is a distutils installed project and thus we cannot accurately
sudo pip install six --upgrade --ignore-installed six
下一篇:
在matlab gui中播放视频的方法