在第二次安装Python时安装rsvg lib

我在RHEL服务器上安装了两个python,一个是版本2.4.x(这是RHEL的一般安装,使用yum更新)和一个用于Django的2.6.x版本,以及每日脚本资源)。

我想获得rsvg为Python 2.6.x工作。 它已经出现在Python 2.4.x中,并存储在这里/usr/lib64/python2.4/site-packages/gtk-2.0/rsvg.so

我的第二个Python安装在这里/opt/python2.6

理想情况下,我想这样做,而不必做一个完整的Python 2.6重新安装!

更新

试图安装整个gnome-python-desktop软件包

 checking for PYGTK... configure: error: Package requirements (pygtk-2.0 >= 2.4.0) were not met. 

真的,我想要的只是python-rsvg。 世界上没有安装任何单一的软件包,这一定是可能的。

更新#2

我已经运行这个来得到我所理解的必要的依赖关系:

 $ yum install pygobject2 pygobject2-devel librsvg2 librsvg2-devel pygtk2 pygtk2-devel 

运行./configure --disable-allbindings --enable-rsvg返回一个消息,即将要构build的唯一模块是metacity

更新#3

尝试使用提供的configuration选项来安装gnome-python-desktop。 运行导致错误的结果:

 metacity.c: In function 'pymetacity_add_constants': metacity.c:955: error: 'META_CURSOR_MOVE_WINDOW' undeclared (first use in this function) metacity.c:955: error: (Each undeclared identifier is reported only once metacity.c:955: error: for each function it appears in.) metacity.c:956: error: 'META_CURSOR_RESIZE_WINDOW' undeclared (first use in this function) make[2]: *** [metacity_la-metacity.lo] Error 1 make[2]: Leaving directory `/tmp/gnome-python-desktop-2.13.3/metacity' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/tmp/gnome-python-desktop-2.13.3' make: *** [all] Error 2 

在pygobject 2.26.0上运行configure (最新的稳定版本?):

 checking for GLIB - version >= 2.22.4... no *** Could not run GLIB test program, checking why... *** The test program failed to compile or link. See the file config.log for the *** exact error that occured. This usually means GLIB is incorrectly installed. configure: error: maybe you want the pygobject-2-4 branch? 

运行make glib 2.26.0:

 /usr/bin/msgfmt -o test.mo ./de.po; \ /bin/mkdir -p de/LC_MESSAGES; \ cp -f test.mo de/LC_MESSAGES ./de.po:15: keyword "msgctxt" unknown ./de.po:15:8: parse error /usr/bin/msgfmt: found 2 fatal errors cp: cannot stat `test.mo': No such file or directory make[4]: *** [test.mo] Error 1 make[4]: Leaving directory `/tmp/glib-2.26.0/gio/tests' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/tmp/glib-2.26.0/gio' make[2]: *** [all] Error 2 make[2]: Leaving directory `/tmp/glib-2.26.0/gio' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/tmp/glib-2.26.0' make: *** [all] Error 2 

这是非常令人沮丧! 有没有办法做到这一点,而不是安装一切?

 export PYTHONPATH=/opt/python2.6 export PATH=/opt/python2.6/bin:$PATH 

然后configure / make / make install python-rsvg模块(从gnome-python-desktop),它应该可以正常工作。

如果只需要rsvg模块,则可以使用./configure --disable-allbindings --enable-rsvg

并确保你已经安装了librsvg2-devel软件包,否则,无论你提供了多lessfunction,模块都不会生成。 🙂

更新:

很显然,在上面的更新#2阶段出了问题,其中./configure告诉你它正在做的事情不是它所说的。 特别是,在configuration帮助中调用了metacity绑定,因为它们维护得不好。

我不太清楚有什么问题 – 在configuration的(long)输出中有帮助吗? 或者,你可以尝试使用waf而不是configure / make。 跑:

 ./waf configure --enable-modules=rsvg ./waf ./waf install 

(注意–disable-allbindings是没有必要的。)

第一行应该告诉你只有rsvg会被build立。

进一步更新:

通过这种方法,你需要将pygtk和pycairo内置到你的/opt/python2.6树中。 这可能是configuration失败的原因。