Python package gi is not found, although python3-gi is installed

I am trying to install the gi package for python3 (it is required for dropbox). I do:

$ sudo apt install python3-gi

and get:

python3-gi is already the newest version (3.36.0-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

But when I do:

$ python3 -m gi

I get:

/usr/local/bin/python3: No module named gi

I do not use anaconda or virtualenv. How can I install gi correctly?

задан 7 July 2020 в 22:00

1 ответ

You have more than one version of Python3 installed.

  • Python3 packages install to /usr/bin/
  • Whatever additional Python3 you installed is at /usr/local/bin/

You are using the wrong Python3.

Here's another way to see it:

$ which -a python3
/usr/bin/python3        <------ Packaged version (correct)
/usr/local/bin/python3  <------ Something else you installed (wrong)
  1. Uninstall that non-package /usr/local version of Python 3. How you uninstall it depends upon how you originally installed it (NOT apt). Since we don't know how you installed it, that's up to you.

  2. Fix your python3 symlink to point to the correct (packaged) version of Python3. In 20.04, it should point to Python3.8. Here's a 20.04 example of correct Python3 symlinks:

    $ ls -l /usr/bin/python3*
    lrwxrwxrwx 1 root root 9 Mar 13 07:20 /usr/bin/python3 -> python3.8
    -rwxr-xr-x 1 root root 5457536 Apr 27 10:53 /usr/bin/python3.8
ответ дан 30 July 2020 в 22:12

Другие вопросы по тегам:

Похожие вопросы: