美文网首页
树莓派——显示中文

树莓派——显示中文

作者: 飞跑的蛤蟆 | 来源:发表于2016-11-16 00:29 被阅读742次

    树莓派默认是采用英文字库的,而且系统里没有预装中文字库,所以即使你在locale中改成中文,也不会显示中文,只会显示一堆方块。因此需要我们手动来安装中文字体。好在有一个中文字体是免费开源使用的。ssh中输入以下命令

    sudo apt-get install ttf-wqy-zenhei

    pi@raspberrypi:~ $ sudo apt-get install ttf-wqy-zenhei
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following extra packages will be installed:
    fonts-wqy-zenhei
    The following NEW packages will be installed:
    fonts-wqy-zenhei ttf-wqy-zenhei
    0 upgraded, 2 newly installed, 0 to remove and 27 not upgraded.
    Need to get 7,485 kB of archives.
    After this operation, 16.9 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main ttf-wqy-zenhei all 0.9.45-6 [9,226 B]
    Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main fonts-wqy-zenhei all 0.9.45-6 [7,475 kB]
    Fetched 7,485 kB in 46s (161 kB/s)
    Selecting previously unselected package fonts-wqy-zenhei.
    (Reading database ... 121063 files and directories currently installed.)
    Preparing to unpack .../fonts-wqy-zenhei_0.9.45-6_all.deb ...
    Unpacking fonts-wqy-zenhei (0.9.45-6) ...
    Selecting previously unselected package ttf-wqy-zenhei.
    Preparing to unpack .../ttf-wqy-zenhei_0.9.45-6_all.deb ...
    Unpacking ttf-wqy-zenhei (0.9.45-6) ...
    Processing triggers for fontconfig (2.11.0-6.3+deb8u1) ...
    Setting up fonts-wqy-zenhei (0.9.45-6) ...
    Setting up ttf-wqy-zenhei (0.9.45-6) ...
    pi@raspberrypi:~ $

    
    中文字库安装完成之后,还需要安装一个中文输入法。输入如下命令
    
        sudo apt-get install scim-pinyin
    
    

    pi@raspberrypi:~ $ sudo apt-get install scim-pinyin
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following extra packages will be installed:
    dialog fonts-arphic-ukai fonts-arphic-uming im-config libscim8c2a scim
    scim-gtk-immodule scim-im-agent scim-modules-socket
    Suggested packages:
    scim-uim scim-hangul scim-chewing scim-m17n scim-prime scim-anthy scim-skk
    scim-canna scim-tables-additional scim-tables-ja scim-tables-ko scim-tables-zh
    scim-thai
    The following NEW packages will be installed:
    dialog fonts-arphic-ukai fonts-arphic-uming im-config libscim8c2a scim
    scim-gtk-immodule scim-im-agent scim-modules-socket scim-pinyin
    0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
    Need to get 19.4 MB of archives.
    After this operation, 48.7 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main fonts-arphic-uming all 0.2.20080216.2-7 [7,821 kB]
    Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main libscim8c2a armhf 1.4.15-3 [226 kB]
    Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main dialog armhf 1.2-20140911-1 [233 kB]
    Get:4 http://mirrordirector.raspbian.org/raspbian/ jessie/main fonts-arphic-ukai all 0.2.20080216.2-4 [8,287 kB]
    Get:5 http://mirrordirector.raspbian.org/raspbian/ jessie/main im-config all 0.27-2 [53.7 kB]
    Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main scim armhf 1.4.15-3 [372 kB]
    Get:7 http://mirrordirector.raspbian.org/raspbian/ jessie/main scim-modules-socket armhf 1.4.15-3 [54.0 kB]
    Get:8 http://mirrordirector.raspbian.org/raspbian/ jessie/main scim-im-agent armhf 1.4.15-3 [60.9 kB]
    Get:9 http://mirrordirector.raspbian.org/raspbian/ jessie/main scim-gtk-immodule armhf 1.4.15-3 [44.3 kB]
    Get:10 http://mirrordirector.raspbian.org/raspbian/ jessie/main scim-pinyin armhf 0.5.92-3 [2,238 kB]
    Fetched 19.4 MB in 1min 34s (206 kB/s)
    Selecting previously unselected package fonts-arphic-uming.
    (Reading database ... 120582 files and directories currently installed.)
    Preparing to unpack .../fonts-arphic-uming_0.2.20080216.2-7_all.deb ...
    Unpacking fonts-arphic-uming (0.2.20080216.2-7) ...
    Selecting previously unselected package libscim8c2a:armhf.
    Preparing to unpack .../libscim8c2a_1.4.15-3_armhf.deb ...
    Unpacking libscim8c2a:armhf (1.4.15-3) ...
    Selecting previously unselected package dialog.
    Preparing to unpack .../dialog_1.2-20140911-1_armhf.deb ...
    Unpacking dialog (1.2-20140911-1) ...
    Selecting previously unselected package fonts-arphic-ukai.
    Preparing to unpack .../fonts-arphic-ukai_0.2.20080216.2-4_all.deb ...
    Unpacking fonts-arphic-ukai (0.2.20080216.2-4) ...
    Selecting previously unselected package im-config.
    Preparing to unpack .../im-config_0.27-2_all.deb ...
    Unpacking im-config (0.27-2) ...
    Selecting previously unselected package scim.
    Preparing to unpack .../scim_1.4.15-3_armhf.deb ...
    Unpacking scim (1.4.15-3) ...
    Selecting previously unselected package scim-modules-socket:armhf.
    Preparing to unpack .../scim-modules-socket_1.4.15-3_armhf.deb ...
    Unpacking scim-modules-socket:armhf (1.4.15-3) ...
    Selecting previously unselected package scim-im-agent.
    Preparing to unpack .../scim-im-agent_1.4.15-3_armhf.deb ...
    Unpacking scim-im-agent (1.4.15-3) ...
    Selecting previously unselected package scim-gtk-immodule:armhf.
    Preparing to unpack .../scim-gtk-immodule_1.4.15-3_armhf.deb ...
    Unpacking scim-gtk-immodule:armhf (1.4.15-3) ...
    Selecting previously unselected package scim-pinyin.
    Preparing to unpack .../scim-pinyin_0.5.92-3_armhf.deb ...
    Unpacking scim-pinyin (0.5.92-3) ...
    Processing triggers for fontconfig (2.11.0-6.3+deb8u1) ...
    Processing triggers for man-db (2.7.0.2-5) ...
    Processing triggers for gnome-menus (3.13.3-6) ...
    Processing triggers for desktop-file-utils (0.22-1) ...
    Processing triggers for mime-support (3.58) ...
    Processing triggers for libgtk2.0-0:armhf (2.24.25-3+deb8u1) ...
    Processing triggers for libgtk-3-0:armhf (3.14.5-1+deb8u1rpi1rpi1g) ...
    Setting up fonts-arphic-uming (0.2.20080216.2-7) ...
    Setting up libscim8c2a:armhf (1.4.15-3) ...
    Setting up dialog (1.2-20140911-1) ...
    Setting up fonts-arphic-ukai (0.2.20080216.2-4) ...
    Setting up im-config (0.27-2) ...
    Setting up scim (1.4.15-3) ...
    update-alternatives: using /etc/X11/xinit/xinput.d/scim to provide /etc/X11/xinit/xinput.d/ja_JP (xinput-ja_JP) in auto mode
    update-alternatives: using /etc/X11/xinit/xinput.d/scim to provide /etc/X11/xinit/xinput.d/ko_KR (xinput-ko_KR) in auto mode
    update-alternatives: using /etc/X11/xinit/xinput.d/scim to provide /etc/X11/xinit/xinput.d/zh_CN (xinput-zh_CN) in auto mode
    update-alternatives: using /etc/X11/xinit/xinput.d/scim to provide /etc/X11/xinit/xinput.d/zh_TW (xinput-zh_TW) in auto mode
    update-alternatives: using /etc/X11/xinit/xinput.d/scim to provide /etc/X11/xinit/xinput.d/zh_HK (xinput-zh_HK) in auto mode
    update-alternatives: using /etc/X11/xinit/xinput.d/scim to provide /etc/X11/xinit/xinput.d/zh_SG (xinput-zh_SG) in auto mode
    update-alternatives: using /etc/X11/xinit/xinput.d/scim-immodule to provide /etc/X11/xinit/xinput.d/ja_JP (xinput-ja_JP) in auto mode
    update-alternatives: using /etc/X11/xinit/xinput.d/scim-immodule to provide /etc/X11/xinit/xinput.d/ko_KR (xinput-ko_KR) in auto mode
    update-alternatives: using /etc/X11/xinit/xinput.d/scim-immodule to provide /etc/X11/xinit/xinput.d/zh_CN (xinput-zh_CN) in auto mode
    update-alternatives: using /etc/X11/xinit/xinput.d/scim-immodule to provide /etc/X11/xinit/xinput.d/zh_TW (xinput-zh_TW) in auto mode
    update-alternatives: using /etc/X11/xinit/xinput.d/scim-immodule to provide /etc/X11/xinit/xinput.d/zh_HK (xinput-zh_HK) in auto mode
    update-alternatives: using /etc/X11/xinit/xinput.d/scim-immodule to provide /etc/X11/xinit/xinput.d/zh_SG (xinput-zh_SG) in auto mode
    Setting up scim-modules-socket:armhf (1.4.15-3) ...
    Setting up scim-im-agent (1.4.15-3) ...
    Setting up scim-gtk-immodule:armhf (1.4.15-3) ...
    Setting up scim-pinyin (0.5.92-3) ...
    Processing triggers for libc-bin (2.19-18+deb8u6) ...
    pi@raspberrypi:~ $

    
    
    
    在输入法安装完成之后,配置一下语言
    `sudo raspi-config`
    
    ![image.png](https://img.haomeiwen.com/i831248/4ab40902f39c517b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    然后选择change_locale
    ![image.png](https://img.haomeiwen.com/i831248/0ce72b64c21066fe.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    
    在 Locales to be generated中选择zh_CN.UTF-8 UTF-8
    ![image.png](https://img.haomeiwen.com/i831248/062372831d498730.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    
    在Default locale for the system environment:中选择c.UTF-8,配置完成之后,输入命令
    ![image.png](https://img.haomeiwen.com/i831248/b2abcaaa1410f75e.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
    
    
    ` sudo reboot`
    
    
    
    重启完成好就可以在VNC或者远程桌面连接上去后使用中文显示和中文输入法了,切换中文输入法一样也是ctrl+space

    相关文章

      网友评论

          本文标题:树莓派——显示中文

          本文链接:https://www.haomeiwen.com/subject/ooilpttx.html