몇 번 헤매다 답을 찾았다.
I had this exact same problem on a Vagrant VM running Ubuntu Xenial 64-bit. No matter how many fonts I had already installed, matplotlib was having a problem with the “system” font name “sans-serif”. I fixed it by:
- Stopping Jupyter
- Installing font-manager:
sudo apt install font-manager
- Cleaning the matplotlib cache directory:
rm ~/.cache/matplotlib -fr
- Restarting Jupyter.
No more error messages about sans-serif.
해당 코드에 아래 두 줄을 삽입한다. 폰트는 찾아서 해당 위치에 넣어 준다.
font_name = font_manager.FontProperties(fname="/usr/share/fonts/truetype/nanum/NanumGothic.ttf").get_name() rc('font', family=font_name)