在ubuntu下安装pycairo

在ubuntu下安装pycairo

本文介绍了在ubuntu下安装pycairo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因,我无法通过python找到开罗.

For some reason I can't get python to find cairo.

当我完成./waf配置时,我得到了

When I did ./waf configure I got

Setting top to                           : /home/user/pycairo/py2cairo-1.10.0
Setting out to                           : /home/user/pycairo/py2cairo-1.10.0/build_directory
./configure()
Checking for 'gcc' (c compiler)          : ok
Checking for program python              : /usr/bin/python
Checking for python version              : (2, 7, 2, 'final', 0)
Checking for library python2.7           : yes
Checking for program python2.7-config    : /usr/bin/python2.7-config
Checking for header Python.h             : yes
Checking for program pkg-config          : /usr/bin/pkg-config
Checking for 'cairo' >= 1.10.0           : yes
Configuration:
PREFIX                                   : /usr/local
LIBDIR                                   : /usr/local/lib

所以接下来我运行./waf安装.

So next I ran ./waf install.

尝试

import cairo
ImportError: No module named cairo

现在,我对下一步的工作感到很困惑.我检查了/usr/local/lib/python2.7/site-packages,它在那里,但是那是唯一的软件包.我还注意到了"dist-packages",我认为那是应该去的地方?

Now I am pretty stumped on what to do next.I checked /usr/local/lib/python2.7/site-packages and it is there but that is the only package there. I also noticed "dist-packages" which I think that is where it's meant to go?

非常感谢您的帮助.

推荐答案

使用具有完整 Ubuntu 支持的打包版本有什么问题?

What is wrong with using the packaged version, with full Ubuntu support?

开罗矢量图形库的Python绑定

Python bindings for the Cairo vector graphics library

http://packages.ubuntu.com/python-gi-cairo

GObject库的Python Cairo绑定

Python Cairo bindings for the GObject library

最新"开罗的使用方式应该是通过gobject内省(第二个软件包):

The "latest" way of using Cairo should be via gobject introspection (second package):

from gi.repository import cairo

主要使用GI存储库中自动生成的API,这些API在各种编程语言中都是一致的.

which uses mostly auto-generated API from the GI repository that is consistent across various programming languages.

这篇关于在ubuntu下安装pycairo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 18:01