"AttributeError: 'NoneType' object has no attribute 'sizes'"
时间: 2023-08-03 13:05:39 浏览: 123
回答: 当出现错误信息"AttributeError: 'NoneType' object has no attribute 'xxx'"时,这意味着在代码中使用了一个NoneType对象,而该对象没有名为'xxx'的属性。\[1\]在这种情况下,通常是因为变量被赋予了None值,而None对象没有任何属性或方法。\[3\]要解决这个问题,可以通过定位代码中赋值为None的变量来找到问题所在。\[3\]在这个特定的例子中,报错信息是"AttributeError: 'NoneType' object has no attribute 'astype'",意味着变量img被赋予了None值,而None对象没有astype属性。\[2\]为了解决这个问题,需要检查代码中关于变量img的赋值部分,确保img被正确地赋予了一个有效的值。\[2\]
#### 引用[.reference_title]
- *1* *3* [[报错]深析AttributeError: ‘NoneType‘ object has no attribute ‘xxx‘(持更)](https://blog.csdn.net/panbaoran913/article/details/124650015)[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^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [问题解决之 AttributeError: ‘NoneType‘ object has no attribute ‘astype](https://blog.csdn.net/qq_39220334/article/details/122887031)[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^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文