我这里用的是华文宋体STSong

1,centos中新建路径存放字体库:/usr/share/fonts/

2,进入Windows下> 的字体库目录c:\windows\Fonts。复制字体库到创建好的字体库目录/usr/share/fonts/。

yum install -y fontconfig mkfontscale //centos 或者是ubuntu系统: apt-get -y install fontconfig xfonts-utils //ubuntu

可能出现的问题-CentOS 已经停止维护的问题。2020 年 12 月 8 号,CentOS 官方宣布了停止维护 CentOS Linux 的计划,并推出了 CentOS Stream 项目,CentOS Linux 8 作为 RHEL 8 的复刻版本,生命周期缩短,于 2021 年 12 月 31 日停止更新并停止维护(EOL),更多的信息可以查看 CentOS 官方公告。如果需要更新 CentOS,需要将镜像从 mirror.centos.org 更改为 vault.centos.org -

解决方案

1.cd /etc/yum.repos.d/

2.sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*

3.sed -i 's|#baseurl=

http://mirror.centos.org

|baseurl=

http://vault.centos.org

|g' /etc/yum.repos.d/CentOS-*

fc-list 查看系统默认字体

/usr/share/fonts/STSONG.TTF: 华文宋体,STSong:style=Regular

如果没生效

更新字体缓存,使用如下命令:

cd /usr/share/fonts/

mkfontscale

mkfontdir

fc-cache

更新matplotlib中的中文字题:

相关文章

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: