Python pygame.camera.init()导入错误

Python pygame.camera.init()导入错误,python,camera,pygame,importerror,Python,Camera,Pygame,Importerror,当我尝试从python中的pygame导入相机模块时,出现导入错误。我在用Pycharm 错误是: Traceback (most recent call last) line 6, in <module> pygame.camera.init() AttributeError: 'module' object has no attribute 'camera' Process finished with exit code 1 尝试-导入pygame.camera。尝试

当我尝试从python中的
pygame
导入相机模块时,出现导入错误。我在用Pycharm

错误是:

Traceback (most recent call last)
line 6, in <module>
    pygame.camera.init()
AttributeError: 'module' object has no attribute 'camera'

Process finished with exit code 1

尝试-
导入pygame.camera
。尝试后,我得到以下错误:ImportError:无法导入名称\u Cameraw哪行获得该错误?pygame.camera.init()中的第7行和pygame导入中的init中的第42行\u Camerap请更新问题中的回溯。另外,似乎您的依赖项安装不正确,您需要首先从安装python opencv或vidcap的依赖项
#!/usr/bin/python
import pygame, sys

from pygame.locals import *

pygame.init()

pygame.camera.init()

screen = pygame.display.set_mode((640,480))

cam = pygame.camera.Camera("/dev/video0",(640,480))

cam.start()

while True:

    image = cam.get_image()

    screen.blit(image,(0,0))

    pygame.display.update()

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()