AttributeError: module 'matplotlib.pyplot' has no attribute 'inshow'. Did you mean: 'imshow'?
时间: 2023-12-16 14:02:23 浏览: 35
这个错误提示是因为你在代码中使用了不存在的函数名inshow,正确的函数名应该是imshow。你可以将代码中的inshow改为imshow即可解决问题。
以下是修改后的代码示例:
```python
import matplotlib.pyplot as plt
# 生成一张图片并显示
img = plt.imread('example.png')
plt.imshow(img)
plt.show()
```
相关问题
AttributeError: module 'matplotlib.pyplot' has no attribute 'inshow'
这个错误是因为您在使用Matplotlib库时,将`imshow`拼写错误为`inshow`。
正确的函数名应该是`imshow`,表示显示图像。
您可以通过将代码中的`inshow`更正为`imshow`来解决这个错误。例如:
```python
import matplotlib.pyplot as plt
# 其他代码...
plt.imshow(image) # 显示图像
plt.show()
```
请注意检查代码中是否还有其他拼写错误或语法错误。
AttributeError: module 'matplotlib.pyplot' has no attribute 'history'
AttributeError: module 'matplotlib.pyplot' has no attribute 'history' 是一个错误提示,意味着在使用matplotlib.pyplot模块时,尝试访问名为'history'的属性,但该属性不存在。
matplotlib.pyplot是一个用于绘制图表的Python库。它提供了许多函数和方法来创建各种类型的图表。然而,'history'并不是matplotlib.pyplot模块的一个有效属性。
可能的原因是你在代码中错误地使用了'matplotlib.pyplot.history',或者你使用的是一个过时的版本的matplotlib,该版本中没有这个属性。
为了解决这个问题,你可以检查以下几点:
1. 确保你正确导入了matplotlib.pyplot模块。可以使用以下语句导入:
```python
import matplotlib.pyplot as plt
```
2. 检查你的代码中是否有对'matplotlib.pyplot.history'的引用。如果有,请删除或修改它。
3. 确保你使用的是最新版本的matplotlib库。你可以通过升级matplotlib来解决这个问题。可以使用以下命令升级:
```python
pip install --upgrade matplotlib
```
相关推荐
![py](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.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://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)