Python cannot install PyGObject

前端 未结 4 1137
误落风尘
误落风尘 2020-12-18 00:38

I try install pygobject by pip

pip install --user PyGObject

but I doesn\'t work:

Collecting PyGObject
  Using cached pygob         


        
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-18 00:47

    For windows

    1. Go to http://www.msys2.org/ and download the x86_64 installer
    2. Follow the instructions on the page for setting up the basic environment
    3. Run C:\msys64\mingw32.exe - a terminal window should pop up
    4. Execute pacman -Suy
    5. Execute pacman -S mingw-w64-i686-gtk3 mingw-w64-i686-python3-gobject
    6. To test that GTK 3 is working you can run gtk3-demo
    7. Copy the hello.py script you created to C:\msys64\home\
    8. In the mingw32 terminal execute python3 hello.py - a window should appear.

    For ubuntu / Debian

    Installing the system provided PyGObject:

    1. Open a terminal
    2. Execute sudo apt install python3-gi python3-gi-cairo gir1.2-gtk-3.0
    3. Change the directory to where your hello.py script can be found (e.g. cd Desktop)
    4. Run python3 hello.py

    Installing from PyPI with pip:

    1. Open a terminal and enter your virtual environment
    2. Execute
      sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0
    3. Execute pip3 install pycairo to build and install Pycairo
    4. Execute pip3 install PyGObject to build and install PyGObject
    5. Change the working directory to where your hello.py script can be found
    6. Run python3 hello.py

    You can read more here

提交回复
热议问题