Cudann 11.8同时安装tensorflow, pytorch
tensorflow, pytorch同时安装
cuda toolkit 11.8兼容tensorflow=2.120-- 2.14
tf=2.14要求python=3.9
tensorflow=2.14.0要求numpy>=1.23.5
cuda toolkit 11.8兼容pytorch>=2.0
具体安装过程
-
cudatoolkit 11.8
在nvidia官网下载并安装toolkit -
安装TF
pip install numpy==1.23.5 -i https://pypi.tuna.tsinghua.edu.cn/simple
conda install conda-forge::tensorflow-gpu=2.14.0
-
测试TF是否正常调用GPU
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
-
pytorch安装
pip install torch==2.6.0 torchvision -i https://pypi.tuna.tsinghua.edu.cn/simple
-
测试pytorch是否正常调用GPU
python3 -c "import torch ; print(torch.cuda.is_available())"