ibus 选字框不见,im-chooser报No module named gtk问题解决过程记录

先说问题原因和解决办法。

根本原因:还是太菜了。

问题原因:我安装了python2.7,它没有gtk模块,并且它安装在/usr/local/bin下,而PATH中/usr/local/bin在/usr/bin的前面,系统会优先执行前面的python。

解决办法:

将/usr/local/bin下面的python文件删掉,它本身就只是一个到python2.7的链接文件。

 

下面是解决过程,很漫长~~~

 

       前几天我的机器在切换到ibus中文输入法的时候,选字框居然不显示了。而且System-->Preferences-->Input Method想要设置,点击“Input Method Preferences” 也没反应了。

       后来在网上搜到这个帖子:ibus-選字框看不到字的問題。但是这个解决不了,而且我的yum刚好被我折腾的不能用了。用系统自带的yum配置根本搜不到安装包。用163的yum源也报错,而且找不到解决办法。

       后来想起来可能是我之前安装goagent的时候安装了python2.7的原因,centos6.4自带的是python2.6。但这个时候我直接的想法是为python安装gtk模块。于是在网上找各种资源安装。不得不说,在linux上如果没有yum或者apt-get这种工具,安装软件简直就是噩梦啊。而我的yum刚好不能用,而且我在网上各种搜,也解决不了。

       最后,为了“锻炼”自己,就在网上自己搜资源安装。pygtk 2.24.0包有各种依赖,依赖的包还依赖其他的包。最后卡在pygobject包上了。我安装都搜最新的包,所以下载安装的是pygobject 3.8.2。但是安装pygtk2.24的时候,又有问题了。

       

*** 'pkg-config --modversion glib-2.0' returned 2.18.4, but GLIB (2.4.7)
> *** was found! If pkg-config was correct, then it is best
> *** to remove the old version of GLib. You may also be able to fix the
> error
> *** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing
> *** /etc/ld.so.conf. Make sure you have run ldconfig if that is
> *** required on your system.
> *** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH
> *** to point to the correct configuration files

 

       又拼命google,最后找到解决办法,因为我之前重新安装了pkg-config,并且我自己安装的包configure的时候都没有--prefix参数,所以需要执行如下命令: 

 

export LD_LIBRARY_PATH=/usr/local/lib
export LIBRARY_PATH=/usr/local/lib
export CPATH=/usr/local/include
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

#不加下面的两个命令,checking for pygobject的时候过不了。
export PYGOBJECT_CFLAGS=/usr/local/include/pygobject-3.0
export PYGOBJECT_LIBS=/usr/local/lib

 

       ok,这个问题解决 ,问题一个一个来:

 

 

checking for codegen... Package pygobject-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `pygobject-2.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pygobject-2.0' found
configure: error: unable to find PyGObject codegen

       但是我明明安装的是pygobject 3.8.2啊,为什么还要pygobject-2.0呢?

 

       pygobect codegen errors这个帖子里说安装完pygobject会在/usr/local/bin下生成pygobject-codegen。但是我安装的pygobject3.8.2明显不会,Installation of PyGObject3.4.2这里也表明了3.X不会安装pygobject-codegen,只会安装一个library。

Contents

Installed Library:libpyglib-gi-2.0-python.so
Installed Directories:/usr/include/pygobject-3.0 and /usr/lib/python2.7/site-packages/gi

         囧了。我只好把pygobject3.8.2卸载了再安装2.X版本。

         安装pygobject2.16的时候,configure不报错,但是make 的时候报错了。

make[3]: *** [_gi_la-pygi-info.lo] Error 1
make[3]: Leaving directory `/home/mayank/Desktop/pygobject-2.26.0/gi'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/mayank/Desktop/pygobject-2.26.0/gi'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/mayank/Desktop/pygobject-2.26.0'

       google之后,有人说是因为introspection的原因。configure的时候 带上--disable-introspection参数就好了。

       2.X版本安装好后,pygtk也顺利装上了。但是选字对话框还是不出现,运行im-chooser还是会报错。这时候我才意识到我现在安装pygtk也只是给系统自带的python2.6安装上了,而不是python2.7。但是为什么我在终端直接运行python版本是2.7.5呢?

[forenroll@forenroll ~]$ python
Python 2.7.5 (default, Sep  2 2013, 20:38:23) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

           我echo $PATH发现/usr/local/bin在/usr/bin的前面。f**k,太笨了。绕了这么大一圈。

           果断把/usr/local/bin下面的python给删了,问题解决。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值