国内网络快速创建pytorch虚拟环境

 新建环境

conda create -n segclip python=3.8 -y
conda activate segclip

 安装库需要使用镜像源

conda 使用镜像源方法:

# 添加清华源的pytorch
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 install pytorch torchvision cudatoolkit=10.0  # 删除安装命令最后的 -c pytorch,才会采用清华源安装。

pip 使用镜像源方法:

pip install torch===1.3.0 torchvision===0.4.1 -i https://pypi.tuna.tsinghua.edu.cn/simple

镜像源可以选择下面几个:

https://mirrors.aliyun.com/pypi/simple/
https://pypi.tuna.tsinghua.edu.cn/simple/
https://pypi.mirrors.ustc.edu.cn/simple/
http://pypi.douban.com/simple/

安装torch

去官网找到对应版本的安装版本

Start Locally | PyTorch

使用conda 镜像源,去掉后面的 -c python

使用pip镜像源,去掉后面的 --index-url xx

扫描二维码关注公众号,回复: 17456962 查看本文章

安装其他库

猜你喜欢

转载自blog.csdn.net/zhoubei654/article/details/139991604