树莓派——显示中文

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了树莓派——显示中文相关的知识,希望对你有一定的参考价值。

参考技术A 树莓派默认是采用英文字库的,而且系统里没有预装中文字库,所以即使你在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:~ $

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 apt-get install ttf-wpy-microhei

sudo fc-cache (这个是刷新字库缓存)
sudo dpkg-reconfigure locales (配置)
在图形界面用上下键和空格选中一下五项

en-GB.UTF-8 UTF-8

zh_CN.GB2312

zh.CN.GB18030 GB18030
zh_CN.GBK GBK

zh_CN.UTF-8 UTF-8
回车,在出现的菜单选择zh_CN.UTF-8 UTF-8为默认。
最后重启,输入 sudo reboot,就可以了
参考技术A 我记得图形界面有language support,可以很方便的设置

以上是关于树莓派——显示中文的主要内容,如果未能解决你的问题,请参考以下文章

如何让树莓派显示中文

树莓派怎么设置中文

树莓派安装显示中文

vncviewer连接树莓派显示无字符

树莓派显示中文和添加中文输入法

树莓派连接电脑显示屏