torchtext安装及常见问题

Pytorch 、 torchtext和Python之间有严格的对应关系: 

在命令窗中安装torchtext

pip install torchtext

注意这种安装方式,在pytorch版本与python版本不兼容时动会自动更新并安装pytorch+cpu版本,安装的新版本pytorch可能会不兼容。慎用。 

如果不兼容会产生以下报错:

C:\Users\刘鸿逸>pip install torchtext
Collecting torchtextUsing cached torchtext-0.16.2-cp310-cp310-win_amd64.whl.metadata (7.5 kB)
Requirement already satisfied: tqdm in d:\python\lib\site-packages (from torchtext) (4.66.1)
Requirement already satisfied: requests in d:\python\lib\site-packages (from torchtext) (2.28.1)
Collecting torch==2.1.2 (from torchtext)Using cached torch-2.1.2-cp310-cp310-win_amd64.whl.metadata (26 kB)
Requirement already satisfied: numpy in d:\python\lib\site-packages (from torchtext) (1.23.0)
Collecting torchdata==0.7.1 (from torchtext)Using cached torchdata-0.7.1-cp310-cp310-win_amd64.whl.metadata (13 kB)
Requirement already satisfied: filelock in d:\python\lib\site-packages (from torch==2.1.2->torchtext) (3.12.0)
Requirement already satisfied: typing-extensions in d:\python\lib\site-packages (from torch==2.1.2->torchtext) (4.5.0)
Requirement already satisfied: sympy in d:\python\lib\site-packages (from torch==2.1.2->torchtext) (1.12)
Requirement already satisfied: networkx in d:\python\lib\site-packages (from torch==2.1.2->torchtext) (2.8.8)
Requirement already satisfied: jinja2 in d:\python\lib\site-packages (from torch==2.1.2->torchtext) (3.1.2)
Collecting fsspec (from torch==2.1.2->torchtext)Using cached fsspec-2023.12.2-py3-none-any.whl.metadata (6.8 kB)
Requirement already satisfied: urllib3>=1.25 in d:\python\lib\site-packages (from torchdata==0.7.1->torchtext) (1.26.12)
Requirement already satisfied: charset-normalizer<3,>=2 in d:\python\lib\site-packages (from requests->torchtext) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in d:\python\lib\site-packages (from requests->torchtext) (3.4)
Requirement already satisfied: certifi>=2017.4.17 in d:\python\lib\site-packages (from requests->torchtext) (2022.9.24)
Requirement already satisfied: colorama in d:\python\lib\site-packages (from tqdm->torchtext) (0.4.6)
Requirement already satisfied: MarkupSafe>=2.0 in d:\python\lib\site-packages (from jinja2->torch==2.1.2->torchtext) (2.1.1)
Requirement already satisfied: mpmath>=0.19 in d:\python\lib\site-packages (from sympy->torch==2.1.2->torchtext) (1.3.0)
Using cached torchtext-0.16.2-cp310-cp310-win_amd64.whl (1.9 MB)
Downloading torch-2.1.2-cp310-cp310-win_amd64.whl (192.3 MB)---------------------------------------- 192.3/192.3 MB 920.3 kB/s eta 0:00:00
Downloading torchdata-0.7.1-cp310-cp310-win_amd64.whl (1.3 MB)---------------------------------------- 1.3/1.3 MB 716.2 kB/s eta 0:00:00
Downloading fsspec-2023.12.2-py3-none-any.whl (168 kB)---------------------------------------- 169.0/169.0 kB 635.0 kB/s eta 0:00:00
Installing collected packages: fsspec, torch, torchdata, torchtextAttempting uninstall: torchFound existing installation: torch 2.0.1Uninstalling torch-2.0.1:Successfully uninstalled torch-2.0.1WARNING: Failed to remove contents in a temporary directory 'D:\Python\Lib\site-packages\~orch'.You can safely remove it manually.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchvision 0.15.2 requires torch==2.0.1, but you have torch 2.1.2 which is incompatible.
Successfully installed fsspec-2023.12.2 torch-2.1.2 torchdata-0.7.1 torchtext-0.16.2

 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchvision 0.15.2 requires torch==2.0.1, but you have torch 2.1.2 which is incompatible.
Successfully installed fsspec-2023.12.2 torch-2.1.2 torchdata-0.7.1 torchtext-0.16.2

已经成功安装了torchtext和其依赖的torch 2.1.2版本,但这个版本的torch与系统中已安装的torchvision 0.15.2版本不兼容,因为torchvision 0.15.2要求torch版本为2.0.1。

 使用以下命令解决版本问题:

pip install torch==2.0.1

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/241952.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【Github搭建网站】零基础零成本搭建个人Web网站~

Github网站&#xff1a;https://github.com/ 这是我个人搭建的网站&#xff1a;https://xf2001.github.io/xf/ 大家可以搭建完后发评论区看看&#xff01;&#xff01;&#xff01; 搭建教程&#xff1a;https://www.bilibili.com/video/BV1xc41147Vb/?spm_id_from333.999.0.0…

亚马逊云科技 WAF 部署小指南(六)追踪 Amazon WAF Request ID,排查误杀原因

众所周知&#xff0c;中国是全球制造业的巨大力量&#xff0c;许多中国企业通过 2B 电商平台网站进行商品销售和采购。在这些电商平台上&#xff0c;Web 应用防火墙&#xff08;WAF&#xff09;成为不可或缺的安全工具。然而&#xff0c;WAF 也可能导致误杀问题。一旦误杀发生&…

postgresql安装

一、官方找到对应的版本,下载 官方下载地址(rpm方式安装):PostgreSQL: Linux downloads (Red Hat family) PostgreSQL: The worlds most advanced open source database 滑到最下面

C# 图解教程 第5版 —— 第22章 命名空间和程序集

文章目录 22.1 引用其他程序集22.2 命名空间22.2.1 命名空间名称22.2.2 命名空间的补充22.2.3 命名空间跨文件伸展22.2.4 嵌套命名空间 22.3 using 指令22.3.1 using 命名空间指令22.3.2 using 别名指令22.3.3 using static 指令 22.4 程序集的结构22.5 程序集标识符22.6 强命名…

JS执行顺序

众所周知&#xff0c;JavaScript 是单线程语言,只能同时执行做一件事(js只有一个线程&#xff0c;称之为main thread-主线程) 1.Javascript 运行机制 main thread 主线程和 call-stack 调用栈(执行栈)&#xff0c;所有的任务都会被放到调用栈等待主线程执行。 2.Javascript 任…

【Vue】vue项目中Uncaught runtime errors:怎样关闭

vue项目中Uncaught runtime errors:怎样关闭 一、背景描述二、报错原因三、解决方案3.1 只显示错误信息不全屏覆盖3.2 取消全屏覆盖 四、参考资料 一、背景描述 项目本来运行的好好&#xff0c;换了个新的浏览器&#xff0c;新的Chrome浏览器版本号是116.0.5845.97&#xff08…

Windows系统下使用docker-compose安装mysql8和mysql5.7

windows环境搭建专栏&#x1f517;点击跳转 win系统环境搭建&#xff08;十四&#xff09;——Windows系统下使用docker安装mysql8和mysql5.7 文章目录 win系统环境搭建&#xff08;十四&#xff09;——Windows系统下使用docker安装mysql8和mysql5.7MySQL81.新建文件夹2.创建…

【 Qt 快速上手】-①- Qt 背景介绍与发展前景

文章目录 1.1 什么是 Qt1.2 Qt 的发展史1.3 Qt 支持的平台1.4 Qt 版本1.5 Qt 的优点1.6 Qt的应用场景1.7 Qt的成功案例1.8 Qt的发展前景及就业分析行业发展方向就业方面的发展前景 1.1 什么是 Qt Qt 是一个跨平台的 C 图形用户界面应用程序框架。它为应用程序开发者提供了建立…

路飞项目--02

补充&#xff1a;axios封装 # 普通使用&#xff1a;安装 &#xff0c;导入使用 const filmListreactive({result:[]}) axios.get().then() async function load(){let responseawait axios.get()filmList.resultresponse.data.results } # 封装示例&#xff1a;请求发出去之前…

【Qt】对象树与坐标系

需要云服务器等云产品来学习Linux的同学可以移步/-->腾讯云<--/-->阿里云<--/-->华为云<--/官网&#xff0c;轻量型云服务器低至112元/年&#xff0c;新用户首次下单享超低折扣。 目录 一、Qt Creator快捷键 二、对象树 1、对象树的析构 2、自定义类的编写…

SpringBoot中整合ElasticSearch快速入门以及踩坑记录

场景 若依前后端分离版手把手教你本地搭建环境并运行项目&#xff1a; 若依前后端分离版手把手教你本地搭建环境并运行项目_本地运行若依前后端分离-CSDN博客 参考上面搭建项目。 ElaticSearch Elasticsearch 是java开发的&#xff0c;基于 Lucene 的搜索引擎。它提供了一…

SQL注入实战操作

一&#xff1a;SQl注入分类 按照注入的网页功能类型分类&#xff1a; 1、登入注入&#xff1a;表单&#xff0c;如登入表单&#xff0c;注册表单 2、cms注入&#xff1a;CMS逻辑:index.php首页展示内容&#xff0c;具有文章列表(链接具有文章id)、articles.php文 章详细页&a…

29、WEB攻防——通用漏洞SQL注入增删改查盲注延迟布尔报错

文章目录 盲注增删改查 盲注 概念&#xff1a;在注入过程中&#xff0c;获取的数据不能回显至前端页面&#xff0c;此时我们需要利用一些方法进行判断或尝试&#xff0c;这个过程被称为盲注。 解决&#xff1a;常规的联合查询注入不行的情况。 分类&#xff1a; 基于布尔的SQ…

Spring | Spring中的Bean--下

Spring中的Bean: 4.Bean的生命周期5.Bean的配装配式 ( 添加Bean到IOC容器的方式 依赖注入的方式 )5.1 基于XML的配置5.2 基于Annotation (注解) 的装配 (更常用&#xff09;5.3 自动装配 4.Bean的生命周期 Spring容器可以管理 singleton作用域的Bean的生命周期&#xff0c;在此…

什么是OSPF?为什么需要OSPF?OSPF基础概念

什么是OSPF&#xff1f; 开放式最短路径优先OSPF&#xff08;Open Shortest Path First&#xff09;是IETF组织开发的一个基于链路状态的内部网关协议&#xff08;Interior Gateway Protocol&#xff09;。 目前针对IPv4协议使用的是OSPF Version 2&#xff08;RFC2328&#x…

《Python数据分析技术栈》第01章 02 Jupyter入门(Getting started with Jupyter notebooks)

02 Jupyter入门&#xff08;Getting started with Jupyter notebooks&#xff09; 《Python数据分析技术栈》第01章 02 Jupyter入门&#xff08;Getting started with Jupyter notebooks&#xff09; Before we discuss the essentials of Jupyter notebooks, let us discuss…

DC-3靶机刷题记录

靶机下载地址&#xff1a; 链接&#xff1a;https://pan.baidu.com/s/1-P5ezyt5hUbmmGMP4EI7kw?pwdrt2c 提取码&#xff1a;rt2c 参考&#xff1a; http://t.csdnimg.cn/hhPi8https://www.vulnhub.com/entry/dc-32,312/ 官网http://t.csdnimg.cn/5mVZ7DC-3 (1).pdfhttps://…

软件是什么?前端,后端,数据库

软件是什么&#xff1f; 由于很多东西没有实际接触&#xff0c;很难理解&#xff0c;对于软件的定义也是各种各样。但是我还是不理解&#xff0c;软件开发中的前端&#xff0c;后端&#xff0c;数据库到底有什么关系呢&#xff01; 这个问题足足困扰了三年半&#xff0c;练习时…

C# 实现单线程异步互斥锁

文章目录 前言一、异步互斥锁的作用是什么&#xff1f;示例一、创建和销毁 二、如何实现&#xff1f;1、标识&#xff08;1&#xff09;标识是否锁住&#xff08;2&#xff09;加锁&#xff08;3&#xff09;解锁 2、异步通知&#xff08;1&#xff09;创建对象&#xff08;2&a…

C++类与对象(四):再谈构造函数(详解初始化列表)、Static成员

上次把默认的成员函数部分梳理完毕了&#xff1a;C初阶类与对象&#xff08;三&#xff09;&#xff1a;详解复制构造函数和运算符重载 今天接着讲下面的内容&#xff1a; 文章目录 1.再谈构造函数1.1构造函数体赋值1.2初始化列表1.2.1格式和概念1.2.2由来情况1情况2 1.2.3特性…