gpt4 book ai didi

python - matplotlib 中的 MPLCCONFIGDIR 错误

转载 作者:太空宇宙 更新时间:2023-11-03 14:33:47 25 4
gpt4 key购买 nike

当我尝试导入 matplotlib.pyplot 时出现以下错误:

RuntimeError("'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir.  You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored "% (h, h))

我的主目录中确实有一个 .matplotlib 目录,该目录归我所有并具有写入权限。那么为什么它告诉我它“不是可写的目录”,我该如何解决这个问题?

最佳答案

不要以 root 身份运行 Python;它不是很安全,以后您可能会遇到更多权限问题。相反,只需确保您拥有主目录和 matplotlib 目录:

sudo chown $USER ~ ~/.matplotlib

关于python - matplotlib 中的 MPLCCONFIGDIR 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5833623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com