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

colab 运行A1代码时遇到的两个问题以及解决方法 #8

Open
gyfffffff opened this issue Aug 13, 2023 · 1 comment
Open

Comments

@gyfffffff
Copy link

问题一:mvcc安装卡住

解决方法,查阅教程文档

!pip install -U openmim
!mim install mmengine
!mim install 'mmcv==2.0.0rc4'

# [如果以上代码运行失败,可以注释以上代码并尝试以下代码

# !pip3 install openmim
# !mim install mmengine
# !mim install 'mmcv>=2.0.0rc1'

问题二:中文字体无法安装和显示

解决方法:
运行!pip show matplotlib 查看matplotlib安装位置,然后将子豪兄的wget的-O参数替换成自己的路径

# Linux操作系统,例如 云GPU平台:https://featurize.cn/?s=d7ce99f842414bfcaea5662a97581bd1
# 如果遇到 SSL 相关报错,重新运行本代码块即可
!wget https://zihao-openmmlab.obs.cn-east-3.myhuaweicloud.com/20220716-mmclassification/dataset/SimHei.ttf   -O /usr/local/lib/python3.10/dist-packages/matplotlib/mpl-data/fonts/ttf/SimHei.ttf
!rm -rf /home/featurize/.cache/matplotlib

还要在fontManger加入下载的字体

import matplotlib
import matplotlib.pyplot as plt

# 要加入以下两行代码,否则不能显示中文
from matplotlib.font_manager import fontManager
fontManager.addfont('/usr/local/lib/python3.10/dist-packages/matplotlib/mpl-data/fonts/ttf/SimHei.ttf')

matplotlib.rc("font",family='SimHei') # 中文字体

然后就可以显示中文了

@TommyZihao
Copy link
Owner

问题一,已在最新的代码教程里修改
问题二,感谢

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