Skip to content

Commit 0ca4921

Browse files
committed
📝 doc(cuda.md): update env configuration
1 parent 2308ec0 commit 0ca4921

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/ai/cuda.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@
1313
- 删除软连接
1414
```shell
1515
cd /usr/local
16-
ls -l cuda #查看cuda的软链接
16+
ls -l cuda # 查看cuda的软链接
1717
sudo rm -rf cuda
1818
sudo ln -s /usr/local/cuda-10.0 /usr/local/cuda # 更换为对应的cuda
1919
```
2020
- 添加环境变量
2121
```shell
22-
# 假设你使用的是bash,那么你需要打开.bashrc
23-
export PATH="/usr/local/cuda-10.0/bin:$PATH"
24-
export LD_LIBRARY_PATH="/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH"
25-
export CUDA_HOME=/usr/local/cuda
22+
# 修改`/etc/profile`以做到多用户、多Shell解释器通用
23+
sudo tee -a /etc/profile > /dev/null << 'EOF'
24+
# CUDA
25+
export PATH=${PATH}:/usr/local/cuda/bin
26+
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64
27+
export CUDA_HOME=/usr/local/cuda # 通过设置软链接`/usr/local/cuda`,可以做到多版本CUDA共存
28+
EOF
2629
```
27-
在完成上述步骤后,你需要 source ~/.bashrc
30+
在完成上述步骤后,你需要`source /etc/profile`刷新环境变量或者`reboot`重启

0 commit comments

Comments
 (0)