pycairo安装失败的解决方法

张志军 3个月前 (08-24) 450次浏览 0个评论

最近在学习使用manim制作一些动画,安装manim的时候需要安装依赖pycairo,安装依赖的过程中出现如下的错误:Collecting pycairo Using cached http://mirrors.aliyun.com/pypi/packages/19/4f/0d48a01......

最近在学习使用manim制作一些动画,安装manim的时候需要安装依赖pycairo,安装依赖的过程中出现如下的错误:


Collecting pycairo
  Using cached http://mirrors.aliyun.com/pypi/packages/19/4f/0d48a017090d4527e921d6892bc550ae869902e67859fc960f8fe63a9094/pycairo-1.26.1.tar.gz (346 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pycairo
  Building wheel for pycairo (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pycairo (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-13.0-x86_64-cpython-312
      creating build/lib.macosx-13.0-x86_64-cpython-312/cairo
      copying cairo/__init__.py -> build/lib.macosx-13.0-x86_64-cpython-312/cairo
      copying cairo/__init__.pyi -> build/lib.macosx-13.0-x86_64-cpython-312/cairo
      copying cairo/py.typed -> build/lib.macosx-13.0-x86_64-cpython-312/cairo
      running build_ext
      'pkg-config' not found.
      Command ['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pycairo
Failed to build pycairo
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (pycairo)

一开始以为是网络问题,重新尝试几次后仍然出现,经过度娘后,通过如下方式解决:


brew install cairo pkg-config

如果是linux的话,可以通过如下方式解决:


sudo apt install libcairo2-dev pkg-config python3-dev   #debian
sudo dnf install cairo-devel pkg-config python3-devel  #fedora
0 0 投票数
文章评分

版权申明:

本博客所有文章除特别声明外均采用BY-NC-SA 4.0许可协议。依据BY-NC-SA 4.0许可协议,转载请附上原文出处链接及本声明。

原文链接:https://ilearning.org.cn/program/pycairo-anzhaung-shibai-de-jiejue-fangfa.html

客官,说点什么吧!

订阅评论
提醒
guest

0 评论
内联反馈
查看所有评论
关于本站
立学网是一个分享个人学习总结的知识网站,内容覆盖编程技术讨论,金融经济,历史哲学,读书笔记,生活随笔等内容。
关注我们
关注微信公众号 关注微博