欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 科技 > IT业 > 服务器安装pytorch-阿里云-centos7

服务器安装pytorch-阿里云-centos7

2025/6/30 0:59:14 来源:https://blog.csdn.net/atbigapp/article/details/141939127  浏览:    关键词:服务器安装pytorch-阿里云-centos7

原文阅读:【巨人肩膀社区·专栏·分享】服务器安装pytorch-阿里云-centos7

1、创建一个虚拟环境

conda create -n pytorch python=3.10

安装成功:



image.png



但是使用上面的命令会失败(疑问?),使用下面的这个可以:

source activate pytorch



image.png



如果版本太高会报这个错:

Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failedPackagesNotFoundError: The following packages are not available from current channels:- python=3.12.5Current channels:- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/linux-64- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r/noarch- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/linux-64- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2/noarchTo search for alternate channels that may provide the conda package you're
looking for, navigate tohttps://anaconda.organd use the search bar at the top of the page.



2、配置安装PyTorch命令

PyTorch



image.png



pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu -i https://mirrors.bfsu.edu.cn/pypi/web/simple --trusted-host mirrors.bfsu.edu.cn

其中-i https://mirrors.bfsu.edu.cn/pypi/web/simple --trusted-host mirrors.bfsu.edu.cn是临时切换pip3下载源,其他部分都是从PyTorch官网配置后复制的。

安装成功截图:



image.png





3、验证pip3 list



image.png



import torch
print(torch.__version__)



image.png



成功打印出了版本号就说明安装成功啦。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词