ImportError: cannot import name 'OrderedDict' from 'typing' (E:\ProgramData\Anaconda3\envs\tensorflow\lib\typing.py)
时间: 2023-08-28 14:22:48 浏览: 121
导入tensorflow时报错:cannot import name 'abs'的解决
这个错误是因为在您的代码中尝试导入'typing'模块的'OrderedDict',但是在'typing'模块中找不到'OrderedDict'。根据引用,在文件maxvit.py中导入了'OrderedDict',但是'typing'模块中并没有这个。根据引用,可能是由于版本不一致导致的问题。您提到您的Anaconda虚拟环境中使用的是Python 3.7版本,而torchvision 1.13.0版本的模块中需要从'typing'模块中导入'OrderedDict'。可能在较高版本的Python中不会出现这个问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [ImportError: cannot import name ‘OrderedDict‘ from ‘typing‘的解决办法](https://blog.csdn.net/weixin_42092516/article/details/128405985)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [ImportError: cannot import name ‘OrderedDict‘ from ‘typing‘ (D:\Programming-language-program\...](https://blog.csdn.net/weixin_46202290/article/details/127886019)[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^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文