Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mac 找不到matplotlibrc #7

Open
welyt opened this issue Aug 30, 2023 · 3 comments
Open

mac 找不到matplotlibrc #7

welyt opened this issue Aug 30, 2023 · 3 comments

Comments

@welyt
Copy link

welyt commented Aug 30, 2023


FileNotFoundError Traceback (most recent call last)
/Users/bytedance/work/project/NB20/wgs_plot.ipynb 单元格 17 in ()
4 from sklearn.preprocessing import StandardScaler, MinMaxScaler
5 from mplfonts.bin.cli import init
----> 6 init()
7 sample_info = sample_info.set_index('sample_id')
8 z_df_T = StandardScaler().set_output(transform='pandas').fit_transform(X=meth_df.transpose())

File ~/work/app/miniconda3/lib/python3.9/site-packages/mplfonts/bin/cli.py:18, in init()
16 """To set default cjk fonts and put into use"""
17 install_fonts()
---> 18 update_custom_rc()
19 shutil.rmtree(matplotlib.get_cachedir())

File ~/work/app/miniconda3/lib/python3.9/site-packages/mplfonts/util/manage.py:46, in update_custom_rc(custom_rc)
40 os.remove(cache_rc_fp)
41 print(
42 f"Warning: The {matplotlib.matplotlib_fname()} "
43 f"already exists, renamed it to {backup_fp}"
44 )
---> 46 shutil.copy(custom_rc, cache_rc_fp)

File ~/work/app/miniconda3/lib/python3.9/shutil.py:427, in copy(src, dst, follow_symlinks)
425 if os.path.isdir(dst):
426 dst = os.path.join(dst, os.path.basename(src))
--> 427 copyfile(src, dst, follow_symlinks=follow_symlinks)
428 copymode(src, dst, follow_symlinks=follow_symlinks)
429 return dst

File ~/work/app/miniconda3/lib/python3.9/shutil.py:266, in copyfile(src, dst, follow_symlinks)
264 with open(src, 'rb') as fsrc:
265 try:
--> 266 with open(dst, 'wb') as fdst:
267 # macOS
268 if _HAS_FCOPYFILE:
269 try:

FileNotFoundError: [Errno 2] No such file or directory: '/Users/bytedance/.matplotlib/matplotlibrc'

@Clarmy
Copy link
Owner

Clarmy commented Aug 30, 2023

@welyt 可以执行一下 ls -l /Users/bytedance/.matplotlib/ 吗?

@welyt
Copy link
Author

welyt commented Aug 30, 2023

total 124
-rw-r--r-- 1 bytedance staff 123964 Aug 30 17:30 fontlist-v330.json

@Clarmy
Copy link
Owner

Clarmy commented Aug 30, 2023

total 124 -rw-r--r-- 1 bytedance staff 123964 Aug 30 17:30 fontlist-v330.json

一个变通的方案是在 /Users/bytedance/.matplotlib/ 目录里创建一个空的 matplotlibrc 文件:$ touch matplotlibrc,然后再执行 $ mplfonts init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants