Pygame导入错误:访问webcamera时无法导入名称_camera

时间:2016-10-22 06:22:26

标签: python

我重新安装pygame 3次,但问题没有得到解决。以下是我的代码。

import pygame
import pygame.camera
import time

pygame.init()
pygame.camera.init()

camlist = pygame.camera.list_cameras()
cam = pygame.camera.Camera("C:/Program Files/iBall Face2Face ROBO K20 Webcam/VideoCap",(640,480))
cam.start()
time.sleep(0.1)  # You might need something higher in the beginning
img = cam.get_image()
pygame.image.save(img,"C:/Users/mswatg05/Desktop/filename.jpg")
cam.stop()

1 个答案:

答案 0 :(得分:4)

默认情况下,相机扩展仅在Linux版本上启用。尝试使用third party compile,然后从同一个地方安装VideoCapture