WSL (Windows Subsystem for Linux) 中使用 PyCharm + `matplotlib` 正确显示 宋体 + Times New Roman

要在 WSL (Windows Subsystem for Linux) 中使用 PyCharm + matplotlib 正确显示 宋体 + Times New Roman + 五号字号(10.5pt) 的图内文字,需要完成以下几个步骤:


✅ 一、字体安装(在 WSL 中)

1. ✔️ 确认你需要的字体文件

你想用的字体包括:

中文字体英文字体五号字号
宋体(SimSun)Times New Roman10.5 pt

这些字体Windows 原生自带,你只需复制到 WSL 下 /usr/share/fonts 目录即可。


2. ✔️ 复制字体文件到 WSL

在 WSL 中执行以下命令:
mkdir -p ~/.fonts/simsun_tnr
cd ~/.fonts/simsun_tnr

然后,从 Windows 复制字体文件到 WSL:

cp /mnt/c/Windows/Fonts/simsun.ttc simsun.ttc
cp /mnt/c/Windows/Fonts/times.ttf times.ttf
cp /mnt/c/Windows/Fonts/timesbd.ttf timesbd.ttf
cp /mnt/c/Windows/Fonts/timesi.ttf timesi.ttf
cp /mnt/c/Windows/Fonts/timesbi.ttf timesbi.ttf

3. ✔️ 更新字体缓存

fc-cache -fv

验证字体安装是否成功:

fc-list | grep -i "simsun"
fc-list | grep -i "times new roman"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值