Cannot import name '_gi'

前端 未结 4 1598
说谎
说谎 2021-01-11 11:58

I\'m trying to add a repository to ppa with the add-apt-repository commands but the _gi module from Python is not found.

I did this command

相关标签:
4条回答
  • 2021-01-11 12:05

    These 2 steps may help you

    $ cd /usr/lib/python3/dist-packages/gi
    $ sudo ln -s _gi.cpython-{36m,37m}-x86_64-linux-gnu.so
    
    0 讨论(0)
  • 2021-01-11 12:09

    Thanks to a comment by Wilhelm, I found that the solution is:

    sudo ln -s /usr/lib/python3/dist-packages/gi/_gi.cpython-{36m,37m}-x86_64-linux-gnu.so
    

    This worked for me with Python 3.7 on Ubuntu.

    0 讨论(0)
  • 2021-01-11 12:10

    Follow the below steps to solve the issue.

    (1) ls -al /usr/bin | grep python

    (2) sudo gedit /usr/bin/add-apt-repository

    Then change the !/usr/bin/python3 to

    !/usr/bin/python3.6
    
    0 讨论(0)
  • 2021-01-11 12:29

    Ubuntu does not like to switch its default interpreter away from python 3.7.

    So switch it back to 3.6 by using

    sudo update-alternatives --config python3
    

    After that try to install the gi package:

    sudo apt install python3-gi
    
    0 讨论(0)
提交回复
热议问题