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

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

1、创建一个虚拟环境

复制代码
conda create -n pytorch python=3.10

安装成功:

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

复制代码
source activate pytorch

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

复制代码
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: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - python=3.12.5

Current 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/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

2、配置安装PyTorch命令

PyTorch

复制代码
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官网配置后复制的。

安装成功截图:

3、验证pip3 list

复制代码
import torch
print(torch.__version__)

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

相关推荐
我的username1 天前
极致简单的openclaw安装教程
人工智能
小锋java12341 天前
【技术专题】嵌入模型与Chroma向量数据库 - Chroma 集合操作
人工智能
七月丶1 天前
别再手动凑 PR 了:这个 AI Skill 会按仓库习惯自动建分支、拆提交、提 PR
人工智能·设计模式·程序员
用户5191495848451 天前
CVE-2024-10793 WordPress插件权限提升漏洞利用演示
人工智能·aigc
chaors1 天前
从零学RAG0x01之向量化
人工智能·aigc·ai编程
chaors1 天前
从零学RAG0x02向量数据库
人工智能·aigc·ai编程
陈少波AI应用笔记1 天前
硅谷龙虾大战技术拆解:当AI长出爪子
人工智能
冬奇Lab1 天前
一天一个开源项目(第39篇):PandaWiki - AI 驱动的开源知识库搭建系统
人工智能·开源·资讯
大模型真好玩1 天前
LangChain DeepAgents 速通指南(三)—— 让Agent告别混乱:Tool Selector与Todo List中间件解析
人工智能·langchain·trae
孟祥_成都1 天前
【全网最通俗!新手到AI全栈开发必读】 AI 是如何进化到大模型的
前端·人工智能·全栈