I have camera set up, which works fine. The thing is, there is an ModuleNotFoundError when I am trying to import pygame. (Note:I am using windows)
This is a test project, and I have to make a camera out of pygame. I've tried some youtube tutorials and I messed with pygame but it always causes an Error.
This is what I have so far:
import pygame.camera
pygame.camera.init()
camera = pygame.camera.list_cameras()[0]
pyg = pygame.camera.Camera(camera (640, 480), 'HSV')
--snip--
if pyg.query_image():
win.blit(pyg.get_image(surface=win), (0, 0))
pygame.quit()
I resulted in the same error every time I tried. The Error message is:
Traceback (most recent call last):
File "C:\Users\roche\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygame\_camera_vidcapture.py", line 31, in init
import vidcap as vc
ModuleNotFoundError: No module named 'vidcap'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\roche\Documents\pygame_camera.py", line 5, in <module>
pygame.camera.init()
File "C:\Users\roche\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygame\camera.py", line 68, in init
_camera_vidcapture.init()
File "C:\Users\roche\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pygame\_camera_vidcapture.py", line 33, in init
from VideoCapture import vidcap as vc
ModuleNotFoundError: No module named 'VideoCapture'
Any Advice?
The Python "ModuleNotFoundError: No module named 'click'" occurs when we forget to install the click module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install click command.
It seems that you are using Windows. So you need to install VideoCapture
module for the pygame.camera
. An easy way is to grab the prebuilt wheel package from here (based on your Python version) and install it with pip
:
pip install VideoCapture‑0.9.5‑cp37‑cp37m‑win32.whl
This should fix the ModuleNotFoundError
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With