报错解决——ImportError: cannot import name ‘container_abcs‘ from ‘torch._six‘ (/home/csj/anaconda3/envs/p

from torch._six import container_abcs, string_classes, int_classes

改成:

string_classes = str
int_classes = int
import collections.abc as container_abcs
  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
这个错误表明在导入torch._six模块的时候,无法找到名为'container_abcs'的变量。 同样的错误也在Crypto.Cipher模块中的_AES变的导入过程中出现。[2] 要解决这个问题,你可以考虑以下几个步骤: 1. 检查你的torch版本,确保你使用的是1.8以上的版本。如果你的torch版本在1.8以下,你可以使用以下代码替换报错的部分:if TORCH_MAJOR == 1 and TORCH_MINOR < 8: from torch._six import container_abcs else: import collections.abc as container_abcs 2. 检查你的Crypto模块是否正确安装。你可以尝试重新安装Crypto模块,或者确保你的安装路径正确。 3. 如果以上方法都没有解决问题,你可以尝试下载附件中的文件,并将其替换到你的python安装目录下对应的位置。这可能会解决导入错误的问题。 通过以上步骤,你应该能够解决ImportError: cannot import name 'container_abcs' from 'torch._six'的错误。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [ImportError: cannot import name ‘container_abcs‘ from ‘torch._six‘ 报错解决方法](https://blog.csdn.net/qq_42499501/article/details/129082358)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [python3 解决cannot import name '_AES'问题](https://download.csdn.net/download/catheringwonder/10487632)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [ImportError: cannot import name ‘container_abcs‘ from ‘torch._six](https://blog.csdn.net/hhhhhhhhhhwwwwwwwwww/article/details/128080114)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值