pythonimportpippython-playsound

ImportError no module named 'playsound'


I did

pip install playsound
Downloading/unpacking playsound
  Downloading playsound-1.2.2-py2.py3-none-any.whl
Installing collected packages: playsound
Successfully installed playsound
Cleaning up...

and it installed playsound (at least is said so), but when i type

python3
Python 3.4.2 (default, Sep 16 2019, 19:58:00) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import playsound
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'playsound'

there is no module? Why does this happen? Oh, I just found out there is no problem when i try to import this when i use python2. There must be a problem with python3 and playsound? How do i import it with python3?


Solution

  • most probably you have both python2 and python3 installed with their package managers, so pip refers to the package manager for python2 instead use

    pip3 install playsound
    

    and it should work fine.