matplotlib 전역 글꼴을 Times New Roman으로 변경

1749 단어

1. 코드 가입:

import matplotlib.pyplot as plt
plt.rc('font',family='Times New Roman') 

2. 잘못 보고하면:

UserWarning: findfont: Font family [u'Times New Roman'] not found. Falling back to DejaVu Sans   (prop.get_family(), self.defaultFamily[fontext]))

3. 설치:

sudo apt install msttcorefonts -qq

Ubuntu 16.04 오류 발생
E: Failed to fetch https://nchc.dl.sourceforge.net/project/corefonts/the fonts/final/andale32.exe  Protocol "http" not supported or disabled in libcurl

4. 솔루션:


글꼴 라이브러리 수동 다운로드
proxychains wget http://downloads.sourceforge.net/corefonts/{andale32.exe,arial32.exe,arialb32.exe,comic32.exe,courie32.exe,georgi32.exe,impact32.exe,times32.exe,trebuc32.exe,verdan32.exe,webdin32.exe}

(wget이 디렉터리를 지정하지 않으면 터미널 현재 디렉터리로 다운로드됩니다.)
제거ttf-mscorefonts-installer:
sudo apt remove --purge ttf-mscorefonts-installer
sudo apt autoremove ttf-mscorefonts-installer

그런 다음 설치를 계속합니다.
sudo apt-get install ttf-mscorefonts-installer
# (       )
sudo dpkg-reconfigure ttf-mscorefonts-installer

두 번째 줄 명령은 알림wget에 따라 다운로드한 글꼴 파일의 디렉터리를 입력하고 TabOK를 누르면 두 번째 줄 명령을 다시 입력할 수 있음을 알릴 수 있습니다. 다시 실행하면 됩니다~

5. 마지막 단계(매우 관건!)

rm ~/.cache/matplotlib -rf

6. msttcorefonts 설치 문제:

Tab 키를 눌러 ok를 선택하여 설치를 계속합니다.
참조:
https://bugs.launchpad.net/ubuntu/+source/msttcorefonts/+bug/1607535 https://askubuntu.com/questions/543673/mscorefonts-problems

좋은 웹페이지 즐겨찾기