栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

怎么安装pytorch

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

怎么安装pytorch

pycharm控制台 输入代码下载pytorch cpu版本
pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

 下面的是其他的辅助你可详细看

(1)pip国内的一些镜像
阿里云 http://mirrors.aliyun.com/pypi/simple/

中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/

豆瓣(douban) http://pypi.douban.com/simple/

清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/

中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
pip install  statsmodels -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.douban.com

python37 -m  pip  install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

pip  install pygame -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.douban.com

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

#pip install --upgrade jupyter
a.临时使用:

可以在使用pip的时候在后面加上-i参数,指定pip源


示例: pip install bs4-i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.douban.com 后边这个代码是信任这个网址的意思
                     库名称
pip install  torchtext -i http://pypi.mirrors.ustc.edu.cn/simple/  --trusted-host pypi.mirrors.ustc.edu.cn
普通的:pip install scipy==1.2.1          速度很慢 
国内源变形:pip install --user tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple/    指定国内源速度很快 
                                                  此处空格

python37 -m pip install transformers -i https://pypi.tuna.tsinghua.edu.cn/simple 

pip install torch-geometric -i https://pypi.tuna.tsinghua.edu.cn/simple 
pip install PyHamcrest==1.9.0 -i https://pypi.tuna.tsinghua.edu.cn/simple 
pip install torch_scatter-1.0.2 (1).tar.gz


pip install torch_scatter-latest+cpu-cp36-cp36m-win_amd64.whl

进入anadacon创建的pytorch屋子环境  conda activate pytorch

torch安装包:网址:https://download.pytorch.org/whl/torch_stable.html

conda pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

cp35是支持python3.5版本的文件  

pytorch离线安装网址

pytorch官网:https://pytorch.org/

一、清华镜像源方案
该方案就是将官网的下载路径,改到清华镜像源的路径,先用activate激活自己之前创建的环境后,在命令行输入以下代码:

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/

然后再去pytorch官网复制下载代码,记得删掉后面的-c pytorch,因为它表示从官网进行下载,不从清华镜像源下。

python37 -m  pip  install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/822353.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号