Search code examples
pythonvlc

Python throwing a "module not found" error for python-vlc


I'm currently making a project that i'm using the python-vlc module for in order to play MP3 audio. Whenever I run the script that the I want the audio to play in.

I've tried a few things, reinstalling VLC to the latest 64-bit version, installing the 32-bit version, reinstalling the python-vlc module itself, upgrading python, but nothing has seemed to have worked.

Here's the code being ran that throws the issue:

import vlc

# Audio Variables
CC_INTRO = vlc.MediaPlayer("audio/CC_INTRO1.mp3")

Normally it should just run the code and be done with it, giving me the ability to call back on the "CC_INTRO" variable and then play the audio, but instead it gives me the error

> Traceback (most recent call last): File "weatherinfo.py", line 4, in import vlc ModuleNotFoundError: No module named 'vlc'

Does anyone know what's going on here? I can't seem to figure it out. Also, I'm using PyCharm, if that helps at all with figuring out the issue.


Solution

  • If it is ModuleNotFoundError then maybe vlc module itself is not installed for the version of python you are using. Make sure you install python-vlc for all versions of Python that you might have on your machine.

    E.g. python3 -m pip install python-vlc