明明有很多事要做,卻偏偏不知道要做什么,這種感覺,很令人上火。
一、基礎知識
在原生ubuntu14.04英文環(huán)境系統(tǒng)中只有IBus拼音,真的好難用。由于搜狗輸入法確實比Linux系統(tǒng)下其它的中文輸入法都要好用得多,所以我決定在我的Ubuntu 14.04系統(tǒng)中安裝搜狗輸入法。Linux系統(tǒng)下的輸入法都是建立在輸入法框架之上,先有輸入法框架,再有具體的輸入法。一個框架上往往有多種輸入法,一個框架上也往往有多種語言的輸入法。在Linux歷史上,曾出現(xiàn)過多種輸入法框架,如SCIM、fcitx、IBus等等。輸入法框架的更替也是很頻繁的,比如曾經(jīng)很火爆的SCIM輸入法框架現(xiàn)在基本上偃旗息鼓了。在最新的Ubuntu系統(tǒng)和Fedora系統(tǒng)中,默認都是使用IBus框架,可是偏偏搜狗輸入法就是建立在fcitx輸入法框架之上。好在Linux系統(tǒng)的默認輸入法框架是可以配置的,也好在Ubuntu的軟件源中有fcitx輸入法框架的軟件包。
二、安裝搜狗輸入法的步驟
1、配置ubuntu
在“系統(tǒng)設置->語言支持”里面,選擇語言,并要應用到系統(tǒng)
注:配置好后需要重啟系統(tǒng)才能生效,不過如果電腦還沒有安裝fcitx,等安裝好這個輸入法框架后在一起重啟。
注:在執(zhí)行此步驟過程中可能會出現(xiàn)下圖提示框,導致無法正常選擇語言選項,這是因為軟件數(shù)據(jù)庫被破壞
解決方法:按照提示框提示運行,sudo apt-get install -f命令 ,這個命令是修復依賴關系(depends)的命令,就是假如你的系統(tǒng)上有某個package不滿足依賴條件,這個命令就會自動修復,安裝那個package依賴的package。不出意外的話就可以解決了,
如果不行就嘗試 執(zhí)行sudo apt-get update 、sudo apt-get upgrade這兩個命令試試
2、配置輸入法框架
搜狗輸入法是建立在fcitx框架之上的,所以要將輸入法框架選擇為fictx
如果沒有fcitx選項,那么你就需要安裝fcitx框架之后在進行配置,安裝的方法是
配置好輸入法框架之后,重啟ubuntu系統(tǒng)。重啟之后如果配置成功,在任務欄的右上角會出現(xiàn)fcitx的設置選項(一個小鍵盤圖標)
3、安裝搜狗拼音輸入法
訪問搜狗輸入法Linux版的官網(wǎng),http://pinyin.sogou.com/linux,下載搜狗輸入法Linux版。從官網(wǎng)可以看到,該輸入法官方只支持Ubuntu(不過網(wǎng)上有人通過將deb包轉換成rpm包,也可以在Fedora上使用該輸入法)。
下載完成之后使用 dpkg -i *.deb 安裝搜狗輸入法。安裝完成之后就可以通過Shift鍵來切換中英文輸入法了。不過要想使用還需要在重啟Ubuntu一次,至此大功告成......
注:在安裝的過程中如果出現(xiàn)下圖報錯信息,是因為下載的過程出錯,或者版本問題,重新下載或者跟換版本即可
正常情況下安裝成功后,即可使用,但有些ubuntu版本還需要去手動添加輸入法,具體步驟如下:
1、點擊右上角的小鍵盤,選擇配置選項,有的版本是Configure Current Input Method選項,圖中是已經(jīng)添加過得,所以會有搜狗圖標
2、點擊如圖所示的“+”號添加輸入法
3、選擇搜狗輸入法(記得勾選如圖選區(qū)部分),因為我已經(jīng)選擇故選項里沒有。
三、vim使用說明
如果使用vim,需要vim支持中文方可在vim使用該輸入法,現(xiàn)在安裝的vim默認是支持中文的,如果不支持安裝一個中文插件就可以了。具體插件的安裝方法可以在網(wǎng)上直接搜索,有很多介紹的。
附上使用圖(真正的大功告成...)
當我們下載WineQQ2012-20120719-Longene.deb到Downloads后,我們打開終端(control+alt+T),然后我們是不是在默認的命令行下輸入了
sudo dpkg -i WineQQ2012-20120719-Longene.deb
回車后發(fā)現(xiàn)如下錯誤代碼:
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
再然后你猜會出現(xiàn)什么呢?看看吧。。。。
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. 環(huán)境介紹
Ubuntu 16.04, sogou輸入法: sogoupinyin_2.0.0.0078_amd64
2. 問題表現(xiàn)
- sudo dpkg -i sogoupinyin_2.0.0.0078_amd64.deb
錯誤信息如下:
- sogoupinyin : Depends: libopencc2 but it is not installable or
- libopencc1 but it is not going to be installed
- Depends: fcitx-libs (>= 4.2.7) but it is not going to be installed
- Depends: fcitx-libs-qt (>= 4.2.7) but it is not going to be installed
- Recommends: fonts-droid-fallback but it is not going to be installed or
- fonts-droid but it is not installable
- 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輸入法并未做相應的系統(tǒng)兼容性測試, 故起最高的Ubuntu支持版本時15.10.
雖然我們知道了問題,但是該如何解決呢?
基于錯誤信息,我們發(fā)現(xiàn)起依賴包有以下幾個: libopencc1 libopencc2, fcitx-libs, fcitx-libs-qt font-droid-fallback.
4. 試錯分析
試錯1:
- bladestone@bladestone-laptop:~$ sudo apt install fcitx-libs
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- You might want to run 'apt-get -f install' to correct these:
- The following packages have unmet dependencies:
- sogoupinyin : Depends: libopencc2 but it is not installable or
- libopencc1 but it is not going to be installed
- Depends: fcitx-libs-qt (>= 4.2.7) but it is not going to be installed
- Recommends: fonts-droid-fallback but it is not going to be installed or
- fonts-droid but it is not installable
- E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
試錯2:
- bladestone@bladestone-laptop:~$ sudo apt install fcitx-libs-qt
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- You might want to run 'apt-get -f install' to correct these:
- The following packages have unmet dependencies:
- sogoupinyin : Depends: libopencc2 but it is not installable or
- libopencc1 but it is not going to be installed
- Depends: fcitx-libs (>= 4.2.7) but it is not going to be installed
- Recommends: fonts-droid-fallback but it is not going to be installed or
- fonts-droid but it is not installable
- E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
試錯3:
- bladestone@bladestone-laptop:~$ sudo apt install fcitx-libs-qt fcitx-libs
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- You might want to run 'apt-get -f install' to correct these:
- The following packages have unmet dependencies:
- sogoupinyin : Depends: libopencc2 but it is not installable or
- libopencc1 but it is not going to be installed
- Recommends: fonts-droid-fallback but it is not going to be installed or
- fonts-droid but it is not installable
- E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
試錯4:
- bladestone@bladestone-laptop:~$ sudo apt install fonts-droid-fallback
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- You might want to run 'apt-get -f install' to correct these:
- The following packages have unmet dependencies:
- sogoupinyin : Depends: libopencc2 but it is not installable or
- libopencc1 but it is not going to be installed
- Depends: fcitx-libs (>= 4.2.7) but it is not going to be installed
- Depends: fcitx-libs-qt (>= 4.2.7) but it is not going to be installed
- E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
試錯5:
- bladestone@bladestone-laptop:~$ sudo apt install libopencc1
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- You might want to run 'apt-get -f install' to correct these:
- The following packages have unmet dependencies:
- sogoupinyin : Depends: fcitx-libs (>= 4.2.7) but it is not going to be installed
- Depends: fcitx-libs-qt (>= 4.2.7) but it is not going to be installed
- Recommends: fonts-droid-fallback but it is not going to be installed or
- fonts-droid but it is not installable
- E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
分析: 經(jīng)過各種嘗試,發(fā)現(xiàn)依然無法正常解決問題,類庫包之間的依賴關系還是非常復雜的。
5. 問題解決
5.1 移除sogou輸入法, 由于其安裝不完整
- sudo apt remove sogoupinyin
執(zhí)行過程:
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- The following packages will be REMOVED:
- sogoupinyin
- 0 upgraded, 0 newly installed, 1 to remove and 43 not upgraded.
- 1 not fully installed or removed.
- After this operation, 42.6 MB disk space will be freed.
- Do you want to continue? [Y/n] y
- (Reading database ... 214444 files and directories currently installed.)
- Removing sogoupinyin (2.0.0.0078) ...
- Processing triggers for libglib2.0-0:amd64 (2.48.1-1~ubuntu16.04.1) ...
- Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
- Processing triggers for shared-mime-info (1.5-2ubuntu0.1) ...
- Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160523-0ubuntu1) ...
- Rebuilding /usr/share/applications/bamf-2.index...
- Processing triggers for gnome-menus (3.13.3-6ubuntu3) ...
- Processing triggers for desktop-file-utils (0.22-1ubuntu5) ...
- Processing triggers for mime-support (3.59ubuntu1) ...
5.2 正確的包安裝姿勢
- sudo apt install libopencc1 fcitx-libs fcitx-libs-qt fonts-droid-fallback
5.3 重新安裝sogou輸入法
- sudo dpkg -i sogoupinyin_2.0.0.0078_amd64.deb
結果 一切順利,沒有報類似的錯誤信息
6. 總結
安裝依賴需要一次安裝完成,切勿單個安裝,主要是由于包之間彼此會有一定的依賴關系,這個是你無法準確定位的,故在 一次安裝動作中做完。
另外, sogou輸入法的Linux版本目前只兼容到Ubunut 15.10, 請大家彼此周知該情況。