简体   繁体   English

ModuleNotFoundError:没有名为“google.colab”的模块 - Python

[英]ModuleNotFoundError: No module named 'google.colab' - Python

I'm following a tutorial to make a face recognition program in python i don't have quite the experience working in python and I am getting this error我正在按照教程在 python 中制作人脸识别程序 我没有在 python 中工作的经验,我收到此错误

line 35, in from google.colab.patches import cv2_imshow ModuleNotFoundError: No module named 'google.colab'第 35 行,在 from google.colab.patches import cv2_imshow ModuleNotFoundError: No module named 'google.colab'

this is my code这是我的代码

from google.colab.patches import cv2_imshow
import cv2
imroot = str(input("Enter Image Path:\n"))
imroot = str("demo_img.jpg")
img = cv2.imread(imroot)
imshow(img)
cv2.waitKey()

i tried searching on google i find this stack overflow question How to resolve ModuleNotFoundError: No module named 'google.colab' so i tried installing google.colab.patches locally but it tells me to install MS Visual C++ i searched on google and found out that i would have to install MS Visual Studio (not VS code), so is there and alternative for displaying images other than importing cv2_imshow from google.colab.patches我尝试在谷歌上搜索我发现这个堆栈溢出问题如何解决 ModuleNotFoundError: No module named 'google.colab'所以我尝试在本地安装 google.colab.patches 但它告诉我安装 MS Visual C++ 我在谷歌上搜索并发现我必须安装 MS Visual Studio(不是 VS 代码),所以除了从 google.colab.patches 导入 cv2_imshow 之外,还有其他显示图像的方法吗

so is there and alternative for displaying images other than importing cv2_imshow from google.colab.patches除了从 google.colab.patches 导入 cv2_imshow 之外,还有其他显示图像的方法

Yes, you can either use Image.show from to trigger the Image Viewer of your system:是的,您可以使用中的Image.show来触发系统的图像查看器:

#pip install pillow
from PIL import Image

img = Image.open("Pictures/Stack_Overflow_logo.png")

img.show()

Or, if you're using Jupyter Notebook, use IPython.display.Image :或者,如果您使用的是 Jupyter Notebook,请使用IPython.display.Image

from IPython.display import Image

Image("Pictures/Stack_Overflow_logo.png")

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何解决 ModuleNotFoundError:没有名为“google.colab”的模块 - How to resolve ModuleNotFoundError: No module named 'google.colab' Google colab:ModuleNotFoundError:没有名为“pymorphy2”的模块 - Google colab : ModuleNotFoundError: No module named 'pymorphy2' ModuleNotFoundError:Google Colab 上没有名为“nets”的模块 - ModuleNotFoundError: No module named 'nets' on Google Colab ModuleNotFoundError:Google Colab 中没有名为“pyaudio”的模块 - ModuleNotFoundError: No module named 'pyaudio' in Google Colab google.colab 模块中是否有 function 来关闭运行时 - Is there a function in google.colab module to close the runtime 在Google Colab中针对“注意ocr”修复“ ModuleNotFoundError:没有名为'fsns'的模块” - Fix “ModuleNotFoundError: No module named 'fsns'” in google colab for Attention ocr ModuleNotFoundError:Google Colab 中没有名为“tensorflow_data_validation”的模块 - ModuleNotFoundError: No module named 'tensorflow_data_validation' in Google Colab 在 google colab 中安装并运行 fairseq(ModuleNotFoundError:没有名为“fairseq”的模块) - install and run fairseq in google colab (ModuleNotFoundError: No module named 'fairseq') ModuleNotFoundError:没有名为“lanenet_model”的模块 - Google Colab - ModuleNotFoundError: No module named 'lanenet_model' - Google Colab Google Colab:ModuleNotFoundError:没有名为“base_positioner”的模块 - Google Colab : ModuleNotFoundError: No module named 'base_positioner'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM