python - 如何在 Ubuntu 10.04 上为 python 3 安装 pycairo

标签 python python-3.x ubuntu-10.04 cairo pycairo

我正在尝试安装 pycairo 1.10.0 以便与我的自定义构建 python 3.1 一起使用。然而,

sudo /flower/bin/easy_install-3.1 pycairo

失败了

XXX@XXXX:/adventures$ sudo /flower/bin/easy_install-3.1 pycairo
install_dir /flower/lib/python3.1/site-packages/
Searching for pycairo
Reading http://pypi.python.org/simple/pycairo/
Reading http://cairographics.org/pycairo
Best match: pycairo 1.10.0
Downloading http://cairographics.org/releases/pycairo-1.10.0.tar.bz2
Processing pycairo-1.10.0.tar.bz2
error: Couldn't find a setup script in /tmp/easy_install-zeG9HB/pycairo-1.10.0.tar.bz2

确实,上述下载中没有setup.py;相反,INSTALL 说:

Install Procedure
-----------------
$ ./waf --help     # shows available waf options
$ ./waf configure  # use --prefix and --libdir if necessary
                   # --prefix=/usr --libdir=/usr/lib64  for Fedora 64-bit
$ ./waf build
$ ./waf install

Use
$ python3 ./waf ...
if you have python2 and python3 installed, and the default is python 2.


Testing
-------
See test/README

我明白这是告诉我应该

sudo /flower/bin/python3.1 ./waf configure --prefix=/flower/pycairo/

或类似的;但是,这会导致以下错误:

  ./options()
Setting top to                           : /tmp/pycairo-1.10.0 
Setting out to                           : /tmp/pycairo-1.10.0/build_directory 
  ./configure()
Checking for 'gcc' (c compiler)          : ok 
Checking for program python              : /usr/bin/python 
python executable '/usr/bin/python' different from sys.executable '/flower/bin/python3.1'
Checking for python version              : (2, 6, 5, 'final', 0) 
The python version is too old, expecting (3, 1, 0)

所以我深入研究了源代码;似乎没有办法告诉这个 waf thingie 目标 python 版本只是它自己运行的版本,所以我摸索着走到了这一步:

Checking for 'gcc' (c compiler)          : ok 
Checking for program python              : /usr/bin/python 
#############293 /flower/bin/python3.1
Checking for python version              : (3, 1, 2, 'final', 0) 
Checking for library python3.1 in LIBDIR : yes 
Checking for program python3.1-config    : not found 
Checking for program python-config-3.1   : not found 
Checking for header Python.h             : Could not find the python development headers 
Checking for []                          : not found 
The configuration failed

我确实有一个文件 /flower/bin/python3.1-config 所以我不明白。执行所有这些操作的 python 代码相当难以处理。

有什么建议如何继续吗?是否有 *.deb 或类似的 pycairo + python 3 准备好?找不到。

最佳答案

通过查看该子目录中的 python.py 文件,我决定在通过 python3 执行 waf 之前尝试设置一个环境变量:
导出 PYTHON="python3"
然后莫名其妙的安装成功了...

关于python - 如何在 Ubuntu 10.04 上为 python 3 安装 pycairo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6232529/

相关文章:

python - VirtualEnv python2.7错误

python - 将 Pipenv 与 git 子模块一起使用

python - Pandas 将值列表更改为列

python-3.x - 如何在 Sphinx :class: directive 后添加复数-s

python - 如何在Python中解析和打印树

compilation - 在 EC2 上的 Ubuntu 中编译内核(没有错误,但没有图像,重启后没有变化)

python - 如何使用其他现有类别覆盖 pandas DataFrames 中的列

python - 在 python 中从文件中检索字典键时出错

javascript - API 响应在 Node 中为 NULL 但在 Python 中运行良好

ubuntu - 如何在 Ubuntu 10.4 中安装 webkit?