Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python py2exe上的网络摄像头无法正常工作_Python_Windows_Pygame_Webcam_Py2exe - Fatal编程技术网

Python py2exe上的网络摄像头无法正常工作

Python py2exe上的网络摄像头无法正常工作,python,windows,pygame,webcam,py2exe,Python,Windows,Pygame,Webcam,Py2exe,嗨,我写了一个使用网络摄像头的程序,但当我用py2exe将其设置为exe时 它会因为这个错误而崩溃 这是我的密码 import pygame.camera import pygame.image import sys pygame.camera.init() cameras = pygame.camera.list_cameras() webcam = pygame.camera.Camera(cameras[0]) webcam.start() # grab first frame

嗨,我写了一个使用网络摄像头的程序,但当我用py2exe将其设置为exe时 它会因为这个错误而崩溃

这是我的密码

import pygame.camera
import pygame.image
import sys
pygame.camera.init()
cameras = pygame.camera.list_cameras()


webcam = pygame.camera.Camera(cameras[0])

webcam.start()

 # grab first frame
img = webcam.get_image()

WIDTH = img.get_width()
HEIGHT = img.get_height()

screen = pygame.display.set_mode( ( WIDTH, HEIGHT ) )
pygame.display.set_caption("pyGame Camera View")

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

     # draw frame
    screen.blit(img, (0,0))
    pygame.display.flip()
     # grab next frame    
    img = webcam.get_image()

谢谢:

不确定这是否可行我无法让python代码在我的计算机上运行,但你尝试过pyinstaller而不是Py2Exe吗?

不确定这是否可行我无法让python代码在我的计算机上运行,但你尝试过pyinstaller而不是Py2Exe吗?

嘿,伙计们,我终于可以用cx\u freeze制作一个可执行文件了 哪一个可以和照相机一起工作 解决方案是将vidcapture.pyd复制到包含程序的文件中


嘿,伙计们,我终于可以用cx\u freeze制作一个可执行文件了 哪一个可以和照相机一起工作 解决方案是将vidcapture.pyd复制到包含程序的文件中


我测试这个,但它有相同的问题我测试这个,但它有相同的问题