私はこれを見て、次のコードを試しました:
ln -s /usr/lib/python2.7/dist-packages/pygtk.pth tools/python_2_7_9/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/gobject tools/python_2_7_9/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/gtk-2.0 tools/python_2_7_9/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/pygtk.pth tools/python_2_7_9/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/glib tools/python_2_7_9/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/gi tools/python_2_7_9/lib/python2.7/site-packages/
ln -s /usr/lib/python2.7/dist-packages/pygtkcompat tools/python_2_7_9/lib/python2.7/site-packages/
、しかし、import glib
またはimport gi
まだエラーが発生します:
yba@ubuntu:~/Documents/XXX/tools$ source python_2_7_9/bin/activate
(python_2_7_9) yba@ubuntu:~/Documents/XXX/tools$ python
Python 2.7.9 (default, Aug 29 2016, 16:04:36)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import glib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/yba/Documents/XXX/tools/python_2_7_9/lib/python2.7/dist-packages/glib/__init__.py", line 22, in <module>
from glib._glib import *
ImportError: /home/yba/Documents/XXX/tools/python_2_7_9/lib/python2.7/dist-packages/glib/_glib.so: undefined symbol: PyUnicodeUCS4_DecodeUTF8
>>> import gi
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/yba/Documents/XXX/tools/python_2_7_9/lib/python2.7/dist-packages/gi/__init__.py", line 36, in <module>
from ._gi import _gobject
ImportError: /home/yba/Documents/lucida/tools/python_2_7_9/lib/python2.7/dist-packages/gi/_gi.so: undefined symbol: PyUnicodeUCS4_FromUnicode
>>>
その投稿と同様に、システム全体の python は正常に動作します。
yba@ubuntu:~$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> import glib
>>>
この問題を解決するには?また、私が本当に必要としているのimport gi.repository
は、import gi
. どうもありがとう!