AttributeError: module ‘torchtext‘ has no attribute ‘legacy‘

问题:

使用torchtext.data 或者 torchtext.legacy 时报错如下:

bash 复制代码
AttributeError: module 'torchtext' has no attribute 'legacy'

AttributeError: module 'torchtext' has no attribute 'data'

解决办法:

bash 复制代码
pip install torchtext==0.6.0  --no-dependencies
相关推荐
程序员爱钓鱼18 分钟前
Python编程实战 · 基础入门篇 | Python的缩进与代码块
后端·python
earthzhang20211 小时前
【1028】字符菱形
c语言·开发语言·数据结构·c++·算法·青少年编程
pr_note1 小时前
python|if判断语法对比
python
江公望2 小时前
Qt的环境变量QT_QPA_PLATFORM浅解
linux·qt
Wang's Blog3 小时前
Linux小课堂: 文件操作核心命令深度解析(cat、less、head、tail、touch 与 mkdir 命令)
linux·chrome·less
earthzhang20213 小时前
第3讲:Go垃圾回收机制与性能优化
开发语言·jvm·数据结构·后端·性能优化·golang
apocelipes4 小时前
golang unique包和字符串内部化
java·python·性能优化·golang
纵有疾風起4 小时前
C++——类和对象(3)
开发语言·c++·经验分享·开源
Geoking.4 小时前
NumPy zeros() 函数详解
python·numpy
Full Stack Developme4 小时前
java.text 包详解
java·开发语言·python