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.
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
Related
I have recently bought a new laptop and was viewing some python projects of mine which I made on my pc. For one of them I use the python-bitvavo-api library which I installed using pip3 install python-bitvavo-api. The version I installed is 1.2.2 which is the latest on their website.
Now when I try to import it using this code: from python_bitvavo_api.bitvavo import Bitvavo, I get the following error:
Traceback (most recent call last):
File "C:\Users\indig\OneDrive\Documenten\Python Projects\Personal\Cryptone\Cryptone.py", line 6, in <module>
from python_bitvavo_api.bitvavo import Bitvavo
ModuleNotFoundError: No module named 'python_bitvavo_api'
I read online that it may occur when using multiple python versions, Im only using 1 and thats python 3.7
Btw. I have the same error with the Pillow module, so it might be a setting in visual studio that I dont know of. Anyway, someone please help. If you need more details please ask.
How are you running it? From the terminal or from VS?
You can also check the installed libraries running the command pip list
Installing OpenCV from prebuilt binaries
Below Python packages are to be downloaded and installed to their default locations.
Python-2.7.x.
Numpy.
Matplotlib (Matplotlib is optional, but recommended since we use it a lot in our tutorials).
Install all packages into their default locations. Python will be installed to C:/Python27/.
After installation, open Python IDLE. Enter import numpy and make sure Numpy is working fine.
Download latest OpenCV release from sourceforge site and double-click to extract it.
Goto opencv/build/python/2.7 folder.
Copy cv2.pyd to C:/Python27/lib/site-packages.
Open Python IDLE and type following codes in Python terminal.
import cv2
print cv2.version If the results are printed out without any errors, congratulations !!! You have installed OpenCV-Python
successfully.
import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <modul
ImportError: No module named cv2
I am trying to get tesseract and opencv up and running for past 2 days.I had uninstall python 3 and almost everything related to it as most of the modules ran in python 2.7 .Still after reverting back python 2.7 and reinstalling everything still its showing No module named cv2.Am at my wits end .Please help me
When ever I say import cv2 and run in IDLE it gives me an error saying:
Traceback (most recent call last): File
"/Users/Victor/Documents/Python Related/Python Code for
Class/blah.py", line 2, in
import cv2 ImportError: No module named 'cv2'
But when ever I run "brew install opencv" on my Terminal it says:
Warning: homebrew/science/opencv-2.4.13.2 already installed, it's just
not linked.
Which I am taking it as Opencv is already installed. I have no idea why it wont work when I run it in python. I have followed this link and
I also used this link.
but that did not seem to help much. I have spent all day on trying to make this work ...
Wanted to see if anyone who has experience with OpenCV can give me a bit of guidance. It is definitely not as simple as installing pygame or other models.
Try export PYTHONPATH=/usr/local/lib/python{version}/site-packages:$PYTHONPATH
so i've recently installed pygame because i want to start programming with it. Before writing code, i decided to just make sure its running fine by testing it in IDLE.
i ran
import pygame
no error
i ran
pygame.init()
and got the following error
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
pygame.init()
AttributeError: module 'pygame' has no attribute 'init'
by doing some research i found out that it may be messing up the path, so i tried
pygame._path_
and got a similar error
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
pygame._path_
AttributeError: module 'pygame' has no attribute '_path_'
and i can't figure out whats wrong. i've tried solutions in other questions but nothing works
im using
Windows 10 Home
Python 3.5.2 32 Bit
Pygame 1.9.2a0 for python 3.2 (but after looking up if it would work with python 3.5, i found resources saying it would)
i tried installing the 3.5 version as a .whl but it had its own host of problems and just decided to use the installer. is the error because of the mismatch between python versions and pygame versions, or is there something else i can try?
I have tried the following
pygame._path_
there is nothing else named pygame.py that would confuse the path
i used the installer
i made sure there were no other versions of python/pygame installed
So are there any other solutions beyond the ones that i have tried to get this one working?
Thank you for your time.
EDIT 1: I have made sure that the only directory named pygame is the module.
to finding the pygame path:
Magic methods have two underscores on either side of them.
to the lack of pygame.init():
different software seem to be able to find different parts of pygame, because PyCharm cannot locate that function, but when running off the command line it operates perfectly. It may just be a fault of idle. Try running from the command line or double clicking the .py file, assuming it is associated with the interpreter. If that doesn't work, run the command
python -m pip install --upgrade pygame
Have you installed pygame correctly.
Put this in your cd (command prompt) to check if you have installed pygame properly
py -m pygame.examples.aliens
If it gives a error then you should use the pip install function
py -m pip install -U pygame --user
If everything fails you can install an IDE. I would recommend pycharm https://www.jetbrains.com/pycharm/download/#section=windows
It is a free IDE and you can install pygame from there for a project
File --> Settings --> Project:(Name) --> Project Interpreter --> pip --> type pygame and install package.
Pycharm pygame installation
I'm trying to write a program to record information from my computers microphone an save it to a file. PyAudio seems like one of the better packages for doing this, and they even have a binary for Windows 7 (Python 2.7). I downloaded the executable file and ran it to set up PyAudio, but when I try to import PyAudio into a python script now I get an error:
Please build and install the PortAudio Python bindings first.
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pyaudio
File "C:\Python27\lib\site-packages\pyaudio.py", line 103, in <module>
sys.exit(-1)
SystemExit: -1
If I look at pyaudio.py, the code that it's failing on is:
# attempt to import PortAudio
try:
import _portaudio as pa
except ImportError:
print "Please build and install the PortAudio Python " +\
"bindings first."
sys.exit(-1)
Also, in case it's relevant, if I go to Python27\Lib\site-packages (where pyaudio.py is) there is a file called portaudio_x64.dll.
The documentation on their site only seems to have instructions for if you want to install PyAudio by building from source code. Additionally, it says that PortAudio v19 is included in the binary, so I assumed it would just work after running the setup executable.
I have no idea what's going wrong and I really need this running soon. Any ideas on what's going wrong? Or if anyone has recommendations for similar packages that work better specifically with Windows 7 (64-bit) and Python 2.7 (Enthought distribution), as well as cross-platform, I'd love to hear them.
Copying the answer from the comments in order to remove this question from the "Unanswered" filter:
Try the binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
~ answer per cgohlke