In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail about linux python Chinese garbled how to do, Xiaobian think quite practical, so share to you as a reference, I hope you can read this article after harvest.
Linux python Chinese garbled solution: 1. View matplotlib font location;2. Upload font to server;3. Delete font cache;4. Restart python application.
Operating environment: linux 5.9.8 system, Anaconda3, Dell G3 computer.
Python Chinese garbled code solution under linux
1. scene description
Linux server installed Anaconda3, Pyhton's K-means algorithm, the result appears as follows: Chinese characters garbled. The last time has been solved, forgot to record the solution process, this time configured a new server, appeared again, the default is not configured, matplotlib will draw garbled code, this time the solution process recorded, hope to help themselves and friends in need.
2. solutions
There are several solutions online, only to introduce their own practical feasible.
1. View matplotlib font location
pythonimport matplotlib print(matplotlib.matplotlib_fname())#Write it down, the font position is: /home/ruanjianlaowang/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/matplotlibrcexit()
2. Upload fonts to server
cd /home/ruanjianlaowang/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/ttf Transfer fonts via ftp or other means, we pass: simhei.ttf
3. Delete font cache
cd ~/.cache/matplotlibrm -rf *
4. Restart Python applications
nohup python k-means.py &
Note: If it hasn't yet taken effect, try changing a configuration file. (We haven't changed this configuration file before, but this time there was an episode, this time with jmeter test, has been garbled, later changed this or not, the original is jmeter problem)
cd /home/ruanjianlaowang/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-datavi matplotlibrc font.family : sans-serif #Remove the previous #font.serif : simhei, DejaVu Serif, #Added simhei
episode
This time with jmeter test, found that all changed or garbled, and later jmeter request added utf-8 parameter can be.
About "linux python Chinese garbled how to do" this article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.