Python 3: Installing gi package with pip

前端 未结 2 570
名媛妹妹
名媛妹妹 2020-12-16 19:41

I am trying to run this Matplotlib example using Python 3. To run this I needed to install gi first (I am using pyenv):

$ python --         


        
2条回答
  •  北荒
    北荒 (楼主)
    2020-12-16 20:19

    To install for the standard python, Håkon Hægland answer is the best choice.

    But for an alternate python version, one can use pip. Beware that the alternate pip has to be used to match the alternate python.

    The full explanations are given in the documentation.

    For instance on openSUSE (standard python version 3.6, alternate installed 3.8):

    > sudo zypper install cairo-devel pkg-config python3-devel gcc gobject-introspection-devel
    > pip3.8 install --user pycairo
    > pip3.8 install --user PyGObject
    > python3.8
    Python 3.8.1 (default, Feb  1 2020, 14:50:41) 
    [GCC 7.5.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import gi
    >>> 
    

提交回复
热议问题