我正在尝试安装 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/