如何在 Ubuntu 10.04 上安装适用于 python 3 的 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 东西,目标 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
我实际上有一个文件 < code>/flower/bin/python3.1-config 所以我不明白。完成所有这些工作的 python 代码相当难以处理。
有什么建议如何继续吗?是否有 pycairo + python 3 的 *.deb
或类似文件?找不到任何。
i am trying to install pycairo 1.10.0 for use with my custom-build python 3.1. however,
sudo /flower/bin/easy_install-3.1 pycairo
fails with
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
and indeed, there is no setup.py
in the said download; instead, the INSTALL
says:
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
i understand that as telling me that i should
sudo /flower/bin/python3.1 ./waf configure --prefix=/flower/pycairo/
or similar; however, this leads to the following error:
./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)
so i went down into the source code; there is seemingly no way to tell this waf
thingie that the targetted python version is simply the one it runs on itself, so i fumbled around and got as far as this:
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
i do in fact have a file /flower/bin/python3.1-config
so i don't get it. the python code that does all this is rather hard to handle.
any suggestions how to go on? is there a *.deb
or similar ready for pycairo + python 3? couldn't find any.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通过查看该子目录中的 python.py 文件,我决定在通过 python3 执行 waf 之前尝试设置一个环境变量:
导出 PYTHON="python3"
然后就神秘的安装成功了...
By looking at the python.py file in that subdir I decided to try setting an environment var before executing the waf thru python3:
export PYTHON="python3"
And then the install mysteriously succeeded...
我使用的是 Ubuntu Karmic,但使用从源代码编译的 python2.7 进行安装,所以这是我在我的案例中找到的解决方法。我认为这可能会有所帮助,但请谨慎使用。
此处发现了一些存在类似安装问题的讨论主题
我在 不同的 python 版本,您可以为 waf 设置一些标志。
使用以下命令后,我通过了 Python.h 部分
由于我是从源代码 python2.7 编译的,所以我需要使用 CFLAGS 重新路由路径。
最终命令如下所示:
我不知道 LDFLAGS 是如何工作的,所以请谨慎使用。
或者(危险的方法),如果你不想设置 CFLAGS,我确实在 python 的
/local/bin
中做了一些符号重新链接到我的 python2.7,与 python 相同-config 到 python2.7-config (如果您从包管理器安装,您可能不需要这样做)I'm using Ubuntu Karmic, but installing with python2.7 compiled from source, so this is a work around I found in my case. I though it might be helpful, but please use caution.
I found some discussion threads that has similar installation problems here
Although it's not the same python version, there are some flags which you can set for waf.
I got past that Python.h part after using the following command
As I have compiled from source python2.7, I need to reroute the paths with CFLAGS.
The final command looks like this:
I have no idea how the LDFLAGS work, so use with caution.
Alternatively (dangerous method), if you don't want to set the CFLAGS, I did do some symbolic-re-linking in the
/local/bin
of python to my python2.7, same with python-config to python2.7-config (if you installed from package manager, you might not need to do this)这显然是 pycairo 安装程序中的一个错误,它试图找出 Python exe 的位置(当它应该做的只是使用它运行时使用的 Python exe 时)。
我试图找到它,但是这段代码使用了它自己的完全自定义的构建系统(这不是显而易见的原因),并且代码以一种非常奇怪的方式布局,令人惊讶的是代码的主要部分隐藏(!)< /strong> 位于一个名为
.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6
的目录中,并用我见过的一些最不可读的 Python 代码编写。因此,我需要几个小时才能理解这段代码并帮助您解决可能是一个微不足道的错误。如果您确实需要这个库,我建议您联系作者并友好地询问他是否可以修复该错误。
This is clearly a bug in the pycairo installer, where it tries to figure out where the Python exe is (when what it should do is to simply use the Python exe that it is run with).
I tried to find it, but this code is using its own completely custom build system (it's not onvious why) and the code is laid out in a very weird way, astonishingly with major parts of the code hidden(!) in a directory called
.waf3-1.6.4-e3c1e08604b18a10567cfcd2d02eb6e6
and written in some of the most unreadable Python code I've ever seen. As such it would take me hours to understand this code and help you with what probably is a trivial bug.If you really need this library I suggest you contact the author and ask him nicely if he can fix the bug.