df -h # 可以看目錄的掛載位置
cd /tmp2
mkdir khaos # 改成你自己的使用者名稱
cd khaos
# 到anaconda官網 找最新版的script下載網址
curl -O https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
bash Anaconda3-2021.05-Linux-x86_64.sh
>>> [ENTER][ENTER][ENTER]
>>> yes
>>> /tmp2/khaos/anaconda3
>>> yes
source ~/.bashrc
Ref: https://www.digitalocean.com/community/tutorials/how-to-install-anaconda-on-ubuntu-18-04-quickstart
# 安裝 TensorFlow 2+cuda 的環境
conda create --name tf python=3.6 anaconda cudatoolkit cudnn tensorflow-gpu
或
conda env list
conda create --name py37withTF python=3.7 anaconda
conda activate py37withTF
nvidia-smi
conda install cudatoolkit=10.1
conda install cudnn=7.6
conda install tensorflow-gpu
測試:
python
import tensorflow as tf
tf.__version__
tf.config.list_physical_devices('GPU')
# tf.test.is_gpu_available()
# 安裝 pytorch+cuda 的環境
conda create --name th python=3.6 anaconda pytorch torchvision torchaudio cudatoolkit -c pytorch
或
conda env list
conda create --name py37withPyTorch python=3.7 anaconda
conda activate py37withPyTorch
nvidia-smi
conda install pytorch torchvision torchaudio cudatoolkit=10.1 -c pytorch
測試:
python
import torch
torch.cuda.is_available()
torch.version.cuda
x = torch.rand(5, 3)
print(x)