成功解决ModuleNotFoundError: No module named ‘torchtext.legacy‘
解决 成功 No module named ModuleNotFoundError
2023-09-14 09:04:49 时间
成功解决ModuleNotFoundError: No module named 'torchtext.legacy'
目录
解决问题
ModuleNotFoundError: No module named 'torchtext.legacy'
解决思路
模块未找到错误:没有名为“torchtext.legacy”的模块
解决方法
torchtext库版本不一致导致使用方法不一样,需要根据具体版本使用对应的函数!
将
# from torchtext.legacy import data
# from torchtext.legacy import datasets
# from torchtext.legacy.vocab import GloVe
改为
改为
from torchtext import data, datasets
from torchtext.vocab import Vocab,GloVe
相关文章
- 成功解决“assert.h”: No such file or directory error: command failed with exit code 2
- 成功解决AttributeError: module tensorflow has no attribute random_normal
- 成功解决PyInstallercompat.py, line 378 out = out.decode(encoding) UnicodeDecodeError: utf-8 codec c
- 成功解决AttributeError: module 'cv2.cv2' has no attribute 'CV_CAP_PROP_FPS'和 'CV_CAP_PROP_FRAME_WIDTH'
- 成功解决SQL Server软件中出现的18456问题
- 成功解决AttributeError: module ‘tensorflow‘ has no attribute ‘contrib‘
- 成功解决AttributeError: ‘int‘ object has no attribute ‘encode‘
- 成功解决pml.Simple derived_col_names[int(obj[‘split_feature‘])], IndexError: list index out of range
- 成功解决AttributeError : ‘GridSearchCV‘ object has no attribute ‘grid_scores_‘
- 成功解决AttributeError: ‘Series‘ object has no attribute ‘split‘
- 成功解决AttributeError: ‘NoneType‘ object has no attribute ‘layers‘
- 成功解决除去或展开pandas.core.frame.DataFrame输出类型中所包含的省略号(列数据或者行数据显示不完全)
- 成功解决ModuleNotFoundError: No module named 'torchvision.ops'
- 成功解决AttributeError: module 'torch.utils' has no attribute 'data'
- 成功解决AttributeError: 'list' object has no attribute 'ndim'
- 成功解决AttributeError: 'DataFrame' object has no attribute 'tolist'
- 成功解决ModuleNotFoundError: No module named 'torch.utils.tensorboard'
- 成功解决TypeError: map() got an unexpected keyword argument 'num_threads'
- 成功解决AttributeError: module 'numpy' has no attribute 'equal'
- 成功解决TypeError: unsupported operand type(s) for +: 'dict_items' and 'list'
- 成功解决model_selection_search.py:584: DeprecationWarning: "fit_params" as a constructor argument was d
- 成功解决ValueError: DataFrame.dtypes for label must be int, float or bool
- 成功解决 AttributeError: module 'tensorflow' has no attribute 'sub'