[Linux] Anaconda initial cudatoolkit and torch configuration script

        Automatically configure cudatoolkit=11.1 and torch=1.8.2 scripts in the new anaconda environment. The commented out part below is the mirror setting. If it has not been configured before, the comment should be uncommented.

# echo "Setting tsinghua and froge mirrors to conda..."
# conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'
# conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/'
# conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
# conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
# conda config --set show_channel_urls yes


echo "Installing cudatoolkit=11.1..."

conda install cudatoolkit=11.1

echo "updating pip and setting mirror..."
pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

echo "installing torch 1.8.2_cu111 to your env..."

pip3 install torch==1.8.2+cu111 torchvision==0.9.2+cu111 torchaudio==0.8.2 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html

        How to use: Create a new .sh file, copy the code into it, and run it directly in the conda environment. (Of course, you can also enter it manually line by line)

Guess you like

Origin blog.csdn.net/weixin_42569673/article/details/121810349