Error Python PlaySound No module named 'gi'

RoktSe picture RoktSe · Nov 18, 2018 · Viewed 7.3k times · Source

when I request using "playsound" library for python to play the audio file .mp3 it returns me the following error:

Code:

import playsound
playsound.playsound("test.mp3")

Error:

    Traceback (most recent call last):
    File "/home/enzoportela/PycharmProjects/SoftwareRover2018.2/SoftRover/I.A Rover(2018.2).py", line 25, in <module>
    playsound.playsound("test.mp3")
  File "/home/enzoportela/anaconda3/envs/SoftwareRover2018.2/lib/python3.6      /site-packages/playsound.py", line 91, in _playsoundNix
    import gi
    ModuleNotFoundError: No module named 'gi'

Answer

D Hudson picture D Hudson · Nov 15, 2020

The most simple way is the vext approach.

pip install vext
pip install vext.gi

Reference: How do I install python3-gi within virtualenv?