Using site-packages with alt-installed Python version

T

Tuomas Vesterinen

I am testing an application GUI with Python 2.4, 2.5 and 2.6. The native
Python (in Fedora 12) is 2.6. Versions 2.4 and 2.5 are alt-installed.

Aplication GUI uses:
import pygtk
pygtk.require('2.0')
import gtk
import gobject

I go to:
$ cd /usr/local/lib/python2.4/site-packages

and say:
$ sudo ln -s /usr/lib/python2.6/site-packages/pygtk.py pygtk.py
$ sudo ln -s /usr/lib/python2.6/site-packages/gtk-2.0 gtk-2.0

and try:
$ python2.4 gui_utils.py
Traceback (most recent call last):
File "gui_utils.py", line 57, in ?
import gtk
File
"/usr/local/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py", line
30, in ?
import gobject as _gobject
File
"/usr/local/lib/python2.4/site-packages/gtk-2.0/gobject/__init__.py",
line 26, in ?
from glib import spawn_async, idle_add, timeout_add,
timeout_add_seconds, \
File
"/usr/local/lib/python2.4/site-packages/gtk-2.0/glib/__init__.py", line
22, in ?
from glib._glib import *
ImportError: /usr/lib/libpyglib-2.0-python.so.0: undefined symbol:
_PyObject_CallFunction_SizeT

What I should say more to get access to the GTK?

Tuomas Vesterinen
 
A

Alister

I am testing an application GUI with Python 2.4, 2.5 and 2.6. The native
Python (in Fedora 12) is 2.6. Versions 2.4 and 2.5 are alt-installed.

Aplication GUI uses:
import pygtk
pygtk.require('2.0')
import gtk
import gobject

I go to:
$ cd /usr/local/lib/python2.4/site-packages

and say:
$ sudo ln -s /usr/lib/python2.6/site-packages/pygtk.py pygtk.py $ sudo
ln -s /usr/lib/python2.6/site-packages/gtk-2.0 gtk-2.0

and try:
$ python2.4 gui_utils.py
Traceback (most recent call last):
File "gui_utils.py", line 57, in ?
import gtk
File
"/usr/local/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py", line
30, in ?
import gobject as _gobject
File
"/usr/local/lib/python2.4/site-packages/gtk-2.0/gobject/__init__.py",
line 26, in ?
from glib import spawn_async, idle_add, timeout_add,
timeout_add_seconds, \
File
"/usr/local/lib/python2.4/site-packages/gtk-2.0/glib/__init__.py", line
22, in ?
from glib._glib import *
ImportError: /usr/lib/libpyglib-2.0-python.so.0: undefined symbol:
_PyObject_CallFunction_SizeT

What I should say more to get access to the GTK?

Tuomas Vesterinen

I am not a great expert on this But I think you need to use the Redhat
alternatives system to switch between versions rather than trying to
change things manually.

as i understand it the Alternatives system sets up and changes various
symlinks to ensure everything works correctly.
 
T

Tuomas Vesterinen

I am not a great expert on this But I think you need to use the Redhat
alternatives system to switch between versions rather than trying to
change things manually.

as i understand it the Alternatives system sets up and changes various
symlinks to ensure everything works correctly.

Yes, my first trial is not the solution because byte compiled .pyc files
must be produced by the corresponding Python version.

PEP 3147 http://www.python.org/dev/peps/pep-3147 suggests a common
solution, but only for Python 3.2 and perhaps 2.7. So I am still looking
for hints. Have You some helpful links to those "Alternatives system"?

Tuomas Vesterinen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top