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 --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64
输入conda config --show channels查看已经加入的镜像源
下载安装pytorch时记得去掉-c pytorch因为已经加入的清华镜像源了,所以就不需要这个pytorch
下面安装python3.10、torch2.0.1、cuda11.8为例:
conda create -n mamba python==3.10.13
conda activate mamba
pip install timm==1.0.8 -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple # 这个不是必要的,但是如果需要该库,最好提前安装,避免后面安装的时候产生冲突,把torch卸载重装会造成安装cpu的情况。
# 但是好像也不行,因为又测试了,好像会自动安装torch版本
conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 -c nvidia
# 上面安装的会造成pip list没有,从而导入失败。试一试下面这种
pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 --index-url https://download.pytorch.org/whl/cu118
我测试过2.1.1的,会提示找不到该版本,所以上述2.0.1足够了
注意:测试后发现,导入会提示没有该库。pip list发现没有,但是conda list有,因此具体怎么解决还未知得知。后续讨论