python库快速安装的方法(镜像网站)

可以使用的库

阿里云:http://mirrors.aliyun.com/pypi/simple/
清华:https://pypi.tuna.tsinghua.edu.cn/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

由于从国外网站下载相关软件包,速度较慢。可以指定国内源进行下载安装。此处通过-i选项指定清华源 https://pypi.tuna.tsinghua.edu.cn/simple 。
执行命令:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow

**

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 --set show_channel_urls yes

Pytorch 清华源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

用conda创建新的环境
conda create --name 新环境名 python=版本号

切换环境命令
conda activate 环境名

安装Pytorch
conda install pytorch torchvision cudatoolkit=版本号

退出环境
conda deactivate

*删除环境(不要乱删哦~)
conda remove -name 环境名
*删除清华源并切换回原版源
conda config --remove-key channels


版权声明:本文为m0_47439365原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。