在OSX上进行pip安装pycairo失败:“ pkg-config”搜索路径问题

时间:2019-06-15 05:56:50

标签: python pip pkg-config pycairo

我一直试图在Mac OS X上安装pycairo。我收到一条错误消息,

最初,我得到'pkg-config' not found。通过brew安装后,我得到Package cairo was not found in the pkg-config search path。原则上,我可以尝试编辑搜索路径,但是由于这是通过pip进行的,所以我希望这一切都会得到解决。有没有办法告诉pip将东西放置在pkg-config知道的地方?

这是完整的消息。

> pip install pycairo
Collecting pycairo
  Using cached https://files.pythonhosted.org/packages/48/20/5e83af98eb897935bf7dc39455e892ba866feebb9b7c3b392982866f9958/pycairo-1.18.1.tar.gz
Building wheels for collected packages: pycairo
  Building wheel for pycairo (setup.py) ... error
  ERROR: Complete output from command /Applications/anaconda/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/f2/bzrj46j11gzdk19j91tp1sq80000gq/T/pip-install-lahb8lq4/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 /private/var/folders/f2/bzrj46j11gzdk19j91tp1sq80000gq/T/pip-wheel-scnvplas --python-tag cp36:
  ERROR: running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.7-x86_64-3.6
  creating build/lib.macosx-10.7-x86_64-3.6/cairo
  copying cairo/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/cairo
  copying cairo/__init__.pyi -> build/lib.macosx-10.7-x86_64-3.6/cairo
  copying cairo/py.typed -> build/lib.macosx-10.7-x86_64-3.6/cairo
  running build_ext
  Package cairo was not found in the pkg-config search path.
  Perhaps you should add the directory containing `cairo.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'cairo' found
  Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.13.1']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for pycairo

如果我使用pip安装旧版本,则会收到相同的错误。

这里有一个类似的问题:How can I fix the problem when installing pycairo on windows?,但它与Windows有关,错误似乎与我不同(答案也让我不满意)。

关于如何解决此问题的任何建议?

0 个答案:

没有答案