Re: No module named 'playsound'
MRAB
python at mrabarnett.plus.com
Mon Jan 9 14:10:28 EST 2023
On 2023-01-09 17:11, Thomas Passin wrote:
>
> I wrote
>
>>> "the most likely reason is that it got installed by a different
>>> version of python than the one that used pip to install it."
>
> That's not quite what I meant to say. Better:
>
> "the most likely reason is that you are trying to import it using a
> different version of python than the one that used pip to install it."
>
On Windows it's best to use pip via the Python Launcher:
py -m pip show playsound
>
> On 1/9/2023 11:59 AM, Mats Wichmann wrote:
>> On 1/9/23 08:30, Thomas Passin wrote:
>>> On 1/9/2023 9:40 AM, om om wrote:
>>>> I'm installing playsound pip install playsound
>>>> but it keeps saying No module named playsound
>>>> and this error occurs on other packages
>>>
>>> Did the installation by pip succeed? if not, what was the error message?
>>>
>>> "It keeps saying ...". What keeps saying that (it's not a standard
>>> error message from pip)? What is the code or command that causes this
>>> error message?
>>>
>>> You would get such a message if you tried to import a package but it
>>> had not been installed. If you used pip to install a package and it
>>> succeeded but you could not import the package (or module), the most
>>> likely reason is that it got installed by a different version of
>>> python than the one that used pip to install it. You may have several
>>> different versions of Python on your computer.
>>>
>>> You can check versions by running
>>>
>>> pip -V
>>
>> As described in this reply, but to be more explicit: if a package
>> installed wtihout error, and then you can't import it in Python, it's
>> basically always a path problem.
>>
>> Invoking pip the same way as you did to install, do:
>>
>> pip show playsound
>>
>> This will tell you where it put it. If that's not a place your Python is
>> looking, it won't find it.
>>
>>>
>>> Then use the command you normally use to run Python (i.e., python3,
>>> py, etc.) and run
>>>
>>> py_x -m pip -V
>>>
>>> (don't type "py_x", use the command name you normally use to run python)
>>>
>>> If the two outputs are different, then you will know for sure that
>>> your packages got installed to a different version of Python.
>>> Re-install them using "python -m pip install" instead of "pip install"
>>> - again, make sure that you use the actual name for the python command
>>> that you normally use.
>>
>>
>
More information about the Python-list
mailing list