关于Matplotlib实验中出现NameError: name ‘rgb2gray‘ is not defined的解决
唉,这个问题搞了老半天!!!
废话少说,直接上解决方案:1:终端pip install install scikit-image
2:python项目中from skimage.color import rgb2gray
完美解决!!!
以下是解决经历:
看的matplotlib显示图像实验中引用了marplotlib.pyplot后直接使用rgb2gray函数,但自己用时就出现了NameError: name 'rgb2gray' is not defined的错误。
翻找了很长时间发现是缺少一个库
大佬kakaccys在一个问题下评论需要加上:from skimage.color import rgb2gray
我直接去pip但是又出现了
Collecting skimage
Downloading skimage-0.0.tar.gz (757 bytes)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [3 lines of output]
*** Please install the `scikit-image` package (instead of `skimage`) ***
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
[notice] A new release of pip available: 22.2.1 -> 22.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip
看到Please install the 'scikit-image'packge
pip了这个全称结果就可以了
关于Matplotlib实验中出现NameError: name ‘rgb2gray‘ is not defined的解决相关推荐
- Open3D中出现NameError: name ‘o3dtut‘ is not defined报错
主要因为open3d_tutorial.py 是官方程序中写好的文件.因为没有下载官方程序,所有会出现报错,如果不下载官方文件只需要在自己的程序内,加入以下代码: class o3dtut:def g ...
- vue中引入jquery方法 或 $ is not defined错误解决方法
1.执行安装jquery依赖包命令安装依赖包 cnpm install jquery --save 2.webpack配置 1).在项目根目录下的build目录下找到webpack.base.conf ...
- NameError: name ‘train_test_split‘ is not defined的解决方法:
加入以下这条语句: from sklearn.model_selection import train_test_split
- NameError: name ‘sklearn‘ is not defined的解决方法:
加入这条语句: from sklearn import datasets加入这条语句之后这样使用X,y=datasets.make_moons(n_samples=N_SAMPLES,noise=0. ...
- NameError: name 'QApplication' is not defined 的解决办法
from PyQt5 import QtCore, QtGui, QtWidgets ########################################## import sys, os ...
- Python报错:NameError: name 'reduce' is not defined 和 reduce()函数介绍
Python报错:NameError: name 'reduce' is not defined 1. 解决报错: 从 functools 模块中导入 reduce 函数: from functool ...
- NameError: name 'reload' is not defined
Python 解决 :NameError: name 'reload' is not defined 问题 解决:NameError: name 'reload' is not defined 问题 ...
- 解决:nameerror: name ‘glpushmatrix‘ is not defined
在尝试gym的render()时,出现错误: nameerror: name 'glpushmatrix' is not defined 最后解决的办法:更换pyglet包的版本 出现错误时的pygl ...
- Lesson 12.1 深度学习建模实验中数据集生成函数的创建与使用
Lesson 12.1 深度学习建模实验中数据集生成函数的创建与使用 为了方便后续练习的展开,我们尝试自己创建一个数据生成器,用于自主生成一些符合某些条件.具备某些特性的数据集.相比于传统的机器学 ...
最新文章
- 苏宁“砍价团”高可用、高并发架构实践
- 两段关于统计日期的sql语句
- java 职责链模式_Java中的责任链模式
- 自定义UserProvider,更改验证方法
- 对软件工程实践课程的预定目标
- python能做什么工作-谁适合学Python?学了Python可以做什么工作?
- vscode 单击跳转 ctrl+鼠标左键不能跳转到函数或变量的定义
- dodaf体系结构建模与分析系统软件
- 浙师大c语言题目,c语言程序设计谭浩强浙师大练习题.doc
- 【计算机三级数据库技术】三级数据库技术应用题集锦
- 【CAD二次开发】CAD常用版本 DwgVersion
- [数据结构]《数据结构教程》多语言微课版创作计划
- Excel 冻结窗口
- matlab plotyy 标注,Matlab关于plotyy 标注 legend 的问题
- 黎曼和 Riemann Sum ,黎曼积分Riemann Integral,正态分布normal distribution
- 基于51单片机的简易数字电压表proteus仿真原理图程序设计
- window.onload用法
- 小程序设置整个页面背景
- 关于Kurento 和 WebRTC-Kurento学习(一)
- OsgEarth加载DEM(数字高程模型)