LINUX安装中文输入法和那些大坑

明明有很多事要做,却偏偏不知道要做什么,这种感觉,很令人上火。

一、基础知识

      在原生ubuntu14.04英文环境系统中只有IBus拼音,真的好难用。由于搜狗输入法确实比Linux系统下其它的中文输入法都要好用得多,所以我决定在我的Ubuntu 14.04系统中安装搜狗输入法。Linux系统下的输入法都是建立在输入法框架之上,先有输入法框架,再有具体的输入法。一个框架上往往有多种输入法,一个框架上也往往有多种语言的输入法。在Linux历史上,曾出现过多种输入法框架,如SCIM、fcitx、IBus等等。输入法框架的更替也是很频繁的,比如曾经很火爆的SCIM输入法框架现在基本上偃旗息鼓了。在最新的Ubuntu系统和Fedora系统中,默认都是使用IBus框架,可是偏偏搜狗输入法就是建立在fcitx输入法框架之上。好在Linux系统的默认输入法框架是可以配置的,也好在Ubuntu的软件源中有fcitx输入法框架的软件包。

二、安装搜狗输入法的步骤

1、配置ubuntu

      在“系统设置->语言支持”里面,选择语言,并要应用到系统

                             

注:配置好后需要重启系统才能生效,不过如果电脑还没有安装fcitx,等安装好这个输入法框架后在一起重启。

注:在执行此步骤过程中可能会出现下图提示框,导致无法正常选择语言选项,这是因为软件数据库被破坏

解决方法:按照提示框提示运行,sudo apt-get install -f命令 ,这个命令是修复依赖关系(depends)的命令,就是假如你的系统上有某个package不满足依赖条件,这个命令就会自动修复,安装那个package依赖的package。不出意外的话就可以解决了,

     如果不行就尝试 执行sudo apt-get update 、sudo apt-get upgrade这两个命令试试

2、配置输入法框架

      搜狗输入法是建立在fcitx框架之上的,所以要将输入法框架选择为fictx

                       

如果没有fcitx选项,那么你就需要安装fcitx框架之后在进行配置,安装的方法是

                                

配置好输入法框架之后,重启ubuntu系统。重启之后如果配置成功,在任务栏的右上角会出现fcitx的设置选项(一个小键盘图标)

                           

3、安装搜狗拼音输入法

      访问搜狗输入法Linux版的官网,http://pinyin.sogou.com/linux,下载搜狗输入法Linux版。从官网可以看到,该输入法官方只支持Ubuntu(不过网上有人通过将deb包转换成rpm包,也可以在Fedora上使用该输入法)。

           

 

下载完成之后使用 dpkg -i *.deb 安装搜狗输入法。安装完成之后就可以通过Shift键来切换中英文输入法了。不过要想使用还需要在重启Ubuntu一次,至此大功告成......

注:在安装的过程中如果出现下图报错信息,是因为下载的过程出错,或者版本问题,重新下载或者跟换版本即可

正常情况下安装成功后,即可使用,但有些ubuntu版本还需要去手动添加输入法,具体步骤如下:

1、点击右上角的小键盘,选择配置选项,有的版本是Configure Current Input Method选项,图中是已经添加过得,所以会有搜狗图标

2、点击如图所示的“+”号添加输入法

3、选择搜狗输入法(记得勾选如图选区部分),因为我已经选择故选项里没有。

 三、vim使用说明

      如果使用vim,需要vim支持中文方可在vim使用该输入法,现在安装的vim默认是支持中文的,如果不支持安装一个中文插件就可以了。具体插件的安装方法可以在网上直接搜索,有很多介绍的。

附上使用图(真正的大功告成...)

    当我们下载WineQQ2012-20120719-Longene.deb到Downloads后,我们打开终端(control+alt+T),然后我们是不是在默认的命令行下输入了
  sudo dpkg -i WineQQ2012-20120719-Longene.deb
  回车后发现如下错误代码:
  dpkg: error processing WineQQ2012-20120719-Longene.deb (--install):
  cannot access archive: No such file or directory
  Errors were encountered while processing:
  WineQQ2012-20120719-Longene.deb

  知道为什么吗?因为我们的操作不是在安装文件夹下进行的,即命令行默认的是/目录,这个目录下没有我们的安装文件,当然会安装不了了!!

SECOND.改进的命令如下
首先进入安装文件所以的文件夹,我们在终端命令这样书写
admin@admin-ThinkPad-Edge:~$ cd Downloads
回车后
admin@admin-ThinkPad-Edge:~/Downloads$看是不是不一样了??!!!!
然后我们再打输入安装命令如下
admin@admin-ThinkPad-Edge:~/Downloads$ sudo dpkg -i WineQQ2012-20120719-Longene.deb
再然后你猜会出现什么呢?看看吧。。。。
Selecting previously unselected package wine-qq2012-longeneteam.
(Reading database ... 195491 files and directories currently installed.)
Unpacking wine-qq2012-longeneteam (from WineQQ2012-20120719-Longene.deb) ...
 #        ####   #    #   ####   ######  #    #  ######
 #       #    #  ##   #  #    #  #       ##   #  #
 #       #    #  # #  #  #       #####   # #  #  #####
 #       #    #  #  # #  #  ###  #       #  # #  #
 #       #    #  #   ##  #    #  #       #   ##  #
 ######   ####   #    #   ####   ######  #    #  ######
*    Extracting ............
Setting up wine-qq2012-longeneteam (2012.06.15) ...
ldconfig....
*    Create desktop icon......
*    Create system menu entry......
*    Done.
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf.index...
Processing triggers for desktop-file-utils ...
Processing triggers for gnome-menus ...
这个时候,我们的QQ安装就成功了!试试吧

1.  环境介绍

   Ubuntu 16.04,   sogou输入法: sogoupinyin_2.0.0.0078_amd64

2.  问题表现

[html]  view plain  copy
 
  1. sudo dpkg -i sogoupinyin_2.0.0.0078_amd64.deb  

   错误信息如下:

[html]  view plain  copy
 
  1. sogoupinyin : Depends: libopencc2 but it is not installable or  
  2. libopencc1 but it is not going to be installed  
  3. Depends: fcitx-libs (>= 4.2.7) but it is not going to be installed  
  4. Depends: fcitx-libs-qt (>= 4.2.7) but it is not going to be installed  
  5. Recommends: fonts-droid-fallback but it is not going to be installed or  
  6. fonts-droid but it is not installable  
  7. E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).  

一看就知道是依赖包存在问题

3.  问题分析

   之前在Ubuntu 15.10的版本之时,使用同样的sogou版本,不存在此类的问题。 但是在Ubuntu 16.04中,却存在此类问题,说明Ubuntu升级之后,sogou输入法并未做相应的系统兼容性测试, 故起最高的Ubuntu支持版本时15.10.

    虽然我们知道了问题,但是该如何解决呢?

    基于错误信息,我们发现起依赖包有以下几个: libopencc1 libopencc2,  fcitx-libs, fcitx-libs-qt  font-droid-fallback.   

4.  试错分析

     试错1:

[html]  view plain  copy
 
  1. bladestone@bladestone-laptop:~$ sudo apt install fcitx-libs  
  2. Reading package lists... Done  
  3. Building dependency tree         
  4. Reading state information... Done  
  5. You might want to run 'apt-get -f install' to correct these:  
  6. The following packages have unmet dependencies:  
  7.  sogoupinyin : Depends: libopencc2 but it is not installable or  
  8.                         libopencc1 but it is not going to be installed  
  9.                Depends: fcitx-libs-qt (>= 4.2.7) but it is not going to be installed  
  10.                Recommends: fonts-droid-fallback but it is not going to be installed or  
  11.                            fonts-droid but it is not installable  
  12. E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).  

   试错2:    

[html]  view plain  copy
 
  1. bladestone@bladestone-laptop:~$ sudo apt install fcitx-libs-qt  
  2. Reading package lists... Done  
  3. Building dependency tree         
  4. Reading state information... Done  
  5. You might want to run 'apt-get -f install' to correct these:  
  6. The following packages have unmet dependencies:  
  7.  sogoupinyin : Depends: libopencc2 but it is not installable or  
  8.                         libopencc1 but it is not going to be installed  
  9.                Depends: fcitx-libs (>= 4.2.7) but it is not going to be installed  
  10.                Recommends: fonts-droid-fallback but it is not going to be installed or  
  11.                            fonts-droid but it is not installable  
  12. E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).  

   试错3:

[html]  view plain  copy
 
  1. bladestone@bladestone-laptop:~$ sudo apt install fcitx-libs-qt fcitx-libs  
  2. Reading package lists... Done  
  3. Building dependency tree         
  4. Reading state information... Done  
  5. You might want to run 'apt-get -f install' to correct these:  
  6. The following packages have unmet dependencies:  
  7.  sogoupinyin : Depends: libopencc2 but it is not installable or  
  8.                         libopencc1 but it is not going to be installed  
  9.                Recommends: fonts-droid-fallback but it is not going to be installed or  
  10.                            fonts-droid but it is not installable  
  11. E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).  

  试错4:

 

[html]  view plain  copy
 
  1. bladestone@bladestone-laptop:~$ sudo apt install fonts-droid-fallback  
  2. Reading package lists... Done  
  3. Building dependency tree         
  4. Reading state information... Done  
  5. You might want to run 'apt-get -f install' to correct these:  
  6. The following packages have unmet dependencies:  
  7.  sogoupinyin : Depends: libopencc2 but it is not installable or  
  8.                         libopencc1 but it is not going to be installed  
  9.                Depends: fcitx-libs (>= 4.2.7) but it is not going to be installed  
  10.                Depends: fcitx-libs-qt (>= 4.2.7) but it is not going to be installed  
  11. E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).  

  试错5:

[html]  view plain  copy
 
  1. bladestone@bladestone-laptop:~$ sudo apt install libopencc1  
  2. Reading package lists... Done  
  3. Building dependency tree         
  4. Reading state information... Done  
  5. You might want to run 'apt-get -f install' to correct these:  
  6. The following packages have unmet dependencies:  
  7.  sogoupinyin : Depends: fcitx-libs (>= 4.2.7) but it is not going to be installed  
  8.                Depends: fcitx-libs-qt (>= 4.2.7) but it is not going to be installed  
  9.                Recommends: fonts-droid-fallback but it is not going to be installed or  
  10.                            fonts-droid but it is not installable  
  11. E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).  

 分析: 经过各种尝试,发现依然无法正常解决问题,类库包之间的依赖关系还是非常复杂的。

5. 问题解决

   5.1 移除sogou输入法, 由于其安装不完整

[html]  view plain  copy
 
  1. sudo apt remove sogoupinyin  

  执行过程:

[html]  view plain  copy
 
  1. Reading package lists... Done  
  2. Building dependency tree         
  3. Reading state information... Done  
  4. The following packages will be REMOVED:  
  5.   sogoupinyin  
  6. 0 upgraded, 0 newly installed, 1 to remove and 43 not upgraded.  
  7. 1 not fully installed or removed.  
  8. After this operation, 42.6 MB disk space will be freed.  
  9. Do you want to continue? [Y/n] y  
  10. (Reading database ... 214444 files and directories currently installed.)  
  11. Removing sogoupinyin (2.0.0.0078) ...  
  12. Processing triggers for libglib2.0-0:amd64 (2.48.1-1~ubuntu16.04.1) ...  
  13. Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...  
  14. Processing triggers for shared-mime-info (1.5-2ubuntu0.1) ...  
  15. Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160523-0ubuntu1) ...  
  16. Rebuilding /usr/share/applications/bamf-2.index...  
  17. Processing triggers for gnome-menus (3.13.3-6ubuntu3) ...  
  18. Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...  
  19. Processing triggers for mime-support (3.59ubuntu1) ...  

  5.2 正确的包安装姿势

 

[html]  view plain  copy
 
  1. sudo apt install libopencc1 fcitx-libs fcitx-libs-qt fonts-droid-fallback  

  5.3 重新安装sogou输入法

[html]  view plain  copy
 
  1. sudo dpkg -i sogoupinyin_2.0.0.0078_amd64.deb  

  结果 一切顺利,没有报类似的错误信息

6. 总结

    安装依赖需要一次安装完成,切勿单个安装,主要是由于包之间彼此会有一定的依赖关系,这个是你无法准确定位的,故在 一次安装动作中做完。

  另外, sogou输入法的Linux版本目前只兼容到Ubunut 15.10, 请大家彼此周知该情况。

转载于:https://www.cnblogs.com/zhugeanran/p/9122565.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值