原因:pytorch版本过低## 标题
解决方案:
第一步:找到下载好的E:\anaconda\package\envs\pytorch_gpu\Lib\site-packages\d2lzh_pytorch安装包里面的utils.py文件,打开。
第二步:将里面的import torchtext 改成 import torchtext.legacy as torchtext
第三步,关闭jupyter重新打开,成功。
参考链接;(1)https://blog.csdn.net/qq_37388085/article/details/114762385?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522162687557716780274111919%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=162687557716780274111919&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_v2~rank_v29-2-114762385.pc_search_result_cache&utm_term=torchtext%E4%BD%BF%E7%94%A8%E6%97%B6%E6%8A%A5module+%E2%80%98torchtext.data%E2%80%98+has+no+attribute+%E2%80%98Iterator%E2%80%98%E9%94%99&spm=1018.2226.3001.4187
(2)https://stackoverflow.com/questions/66854921/legacy-torchtext-0-9-0