ImportError: cannot import name 'TryExcept' from 'utils' (D:\anaconda\envs\cv\Lib\site-packages\cv2\utils\__init__.py)
时间: 2023-09-13 18:10:07 浏览: 1701
该错误是因为在导入模块时出现了问题。在引用中提到,解决`ImportError: Failed to import pydot. You must install pydot and graphviz for 'pydotprint' to work.`的错误,您需要安装pydot和graphviz模块。您可以使用以下命令来安装它们:
```
pip install pydot graphviz
```
关于引用中的错误`ImportError: cannot import name 'amp' from 'torch.cuda'`,这是由于您的torch.cuda模块中没有`amp`这个属性引起的。您可以尝试更新您的torch版本,使用以下命令:
```
pip install --upgrade torch
```
如果更新torch后仍然出现该错误,可能是因为您正在使用的yolov5版本不兼容您的torch版本。您可以尝试使用与您torch版本兼容的yolov5版本。
对于引用中的问题`ImportError: cannot import name 'TryExcept' from 'utils' (D:\anaconda\envs\cv\Lib\site-packages\cv2\utils\__init__.py)`,这个错误提示表明在`D:\anaconda\envs\cv\Lib\site-packages\cv2\utils\__init__.py`中没有名为`TryExcept`的属性。可能是因为您正在使用的cv2版本与该代码不兼容。您可以尝试更新cv2版本或查看代码中是否使用了不存在的属性。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.](https://blog.csdn.net/qq_37337494/article/details/101956466)[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: 50%"]
- *2* [yolov5的3.0版本代码在训练的时候报错:ImportError: cannot import name ‘amp‘ from ‘torch.cuda‘ ...](https://blog.csdn.net/weixin_41010198/article/details/108124252)[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: 50%"]
[ .reference_list ]
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)