当前位置: 首页 > 工具软件 > PyGObject > 使用案例 >

pygobject pip3升级问题:ERROR: Failed building wheel for pycairo

边霄
2023-12-01

问题

这个问题是从很长一段问题中截出来的,全文如下,是使用pip3或者说pip-review升级遇到的问题

pygobject==3.34.0 is available (you have 3.26.1)
Defaulting to user installation because normal site-packages is not writeable
Processing /home/thinszx/.cache/pip/wheels/78/4f/f8/35219d6282fc7d90d6713924a12fd05bb0f7eef0fa12bef507/distro_info-0.0.0-py3-none-any.whl
Collecting pygobject==3.34.0
  Using cached PyGObject-3.34.0.tar.gz (699 kB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /home/thinszx/.local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-pbwzvrms/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
       cwd: None
  Complete output (50 lines):
  Collecting setuptools
    Using cached setuptools-45.2.0-py3-none-any.whl (584 kB)
  Collecting wheel
    Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
  Collecting pycairo
    Using cached pycairo-1.19.0.tar.gz (200 kB)
  Building wheels for collected packages: pycairo
    Building wheel for pycairo (setup.py): started
    Building wheel for pycairo (setup.py): finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sa57e6b8/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-sa57e6b8/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-pgit5hrh
         cwd: /tmp/pip-install-sa57e6b8/pycairo/
    Complete output (12 lines):
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/cairo
    copying cairo/__init__.py -> build/lib.linux-x86_64-3.6/cairo
    copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.6/cairo
    copying cairo/py.typed -> build/lib.linux-x86_64-3.6/cairo
    running build_ext
    'pkg-config' not found.
    Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']
    ----------------------------------------
    ERROR: Failed building wheel for pycairo
    Running setup.py clean for pycairo
  Failed to build pycairo
  Installing collected packages: setuptools, wheel, pycairo
      Running setup.py install for pycairo: started
      Running setup.py install for pycairo: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sa57e6b8/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-sa57e6b8/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-y2i60oh4/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-pbwzvrms/overlay --compile --install-headers /tmp/pip-build-env-pbwzvrms/overlay/include/python3.6m/pycairo              cwd: /tmp/pip-install-sa57e6b8/pycairo/
      Complete output (12 lines):
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.6
      creating build/lib.linux-x86_64-3.6/cairo
      copying cairo/__init__.py -> build/lib.linux-x86_64-3.6/cairo
      copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.6/cairo
      copying cairo/py.typed -> build/lib.linux-x86_64-3.6/cairo
      running build_ext
      'pkg-config' not found.
      Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sa57e6b8/pycairo/setup.py'"'"'; __file__='"'"'/tmp/pip-install-sa57e6b8/pycairo/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-y2i60oh4/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-pbwzvrms/overlay --compile --install-headers /tmp/pip-build-env-pbwzvrms/overlay/include/python3.6m/pycairo Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /home/thinszx/.local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-pbwzvrms/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output. 

解决方法

查到了ubuntu 小白,对于 package 升级的问题 - V2EX,说是pip或者pip3升级都会有问题,因为少了libgirepository1.0-dev的依赖,安装

sudo apt-get install libgirepository1.0-dev

然后还少一个cario

sudo apt-get install python-cairo
sudo apt-get install libcairo2
 类似资料: