import torch._six
时间: 2023-08-22 21:05:32 浏览: 191
引用\[1\]中提到,如果在导入`torch._six`时出现错误,可以尝试将源码中的`from torch._six import inf`修改为`try: from torch._six import inf except ModuleNotFoundError: from torch import inf`。这样可以避免导入错误。\[1\]
引用\[2\]中提到,如果想找到`torch._six`的文件路径,可以在低版本中导入`torch._six`,然后按下ctrl并点击`torch._six`,PyCharm会显示出`_six.py`的脚本文件路径。\[2\]
引用\[3\]中提到,解决`import torch._six`的问题的方法是先从低版本的torch中下载`_six.py`文件,然后将该文件移植到高版本的torch包中。此外,还需要在高版本torch的初始化文件中进行相关配置。\[3\]
#### 引用[.reference_title]
- *1* [ModuleNotFoundError: No module named ‘torch._six‘的解决方案](https://blog.csdn.net/weixin_43178406/article/details/130362406)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [module ‘torch‘ has no attribute ‘_six](https://blog.csdn.net/xiaohukkkl/article/details/130665584)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文