The World’s Largest Online Community for Developers

'; python - while adding this repo in ubuntu sudo apt-add-repository ppa:brightbox/ruby-ng error - LavOzs.Com

i have tired adding this ruby repo for installing 2.4 version of ruby, the error message is shown bellow

sudo apt-add-repository ppa:brightbox/ruby-ng

but i got this error i have tried all this links

python add-apt-repository: ImportError: No module named 'apt_pkg'

How to fix 'ModuleNotFoundError: No module named 'apt_pkg'?

Traceback (most recent call last):
  File "/usr/bin/apt-add-repository", line 11, in <module>
    from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
  File "/usr/lib/python3/dist-packages/softwareproperties/", line 28, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Try these methods and find if it works

apt-get remove --purge python-apt

and then

apt-get install python-apt