improve wsl dependencies installation

This commit is contained in:
josc146 2023-07-07 18:57:51 +08:00
parent c725d11dd9
commit 55210c89e2

View File

@ -8,6 +8,12 @@ if [[ ${cnMirror} == 1 ]]; then
fi fi
fi fi
if dpkg -s "gcc" >/dev/null 2>&1; then
echo "gcc installed"
else
sudo apt -y install gcc
fi
if dpkg -s "python3-pip" >/dev/null 2>&1; then if dpkg -s "python3-pip" >/dev/null 2>&1; then
echo "pip installed" echo "pip installed"
else else
@ -20,14 +26,14 @@ else
sudo apt -y install ninja-build sudo apt -y install ninja-build
fi fi
if dpkg -s "cuda" >/dev/null 2>&1; then if dpkg -s "cuda" >/dev/null 2>&1 && dpkg -s "cuda" | grep Version | awk '{print $2}' | grep -q "12"; then
echo "cuda installed" echo "cuda 12 installed"
else else
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin wget -N https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600 sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda-repo-wsl-ubuntu-11-7-local_11.7.0-1_amd64.deb wget -N https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda-repo-wsl-ubuntu-12-2-local_12.2.0-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-11-7-local_11.7.0-1_amd64.deb sudo dpkg -i cuda-repo-wsl-ubuntu-12-2-local_12.2.0-1_amd64.deb
sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/cuda-*-keyring.gpg /usr/share/keyrings/ sudo cp /var/cuda-repo-wsl-ubuntu-12-2-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update sudo apt-get update
sudo apt-get -y install cuda sudo apt-get -y install cuda
fi fi