栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

导入matplotlib.pyplot as plt画图问题Matplotlib created a temporary config/cache directory at /tmp/matplotl

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

导入matplotlib.pyplot as plt画图问题Matplotlib created a temporary config/cache directory at /tmp/matplotl

在需要使用matplotlib在py文件中画图时,导入这个包的同时可能会出现以下问题:

在import matplotlib.pyplot as plt时出现:

Matplotlib created a temporary config/cache directory at /tmp/matplotlib-4c7itqfv because the default path (/home/xx/.config/matplotlib) is not a writable directory; it is highly recommended to set the MPLConFIGDIR environment variable to a writable directory, in particular to speed up the import of Matplotlib and to better support multiprocessing.

原因不详。

解决方法:

在import matplotlib.pyplot as plt之前:

import os
os.environ['MPLCONFIGDIR'] = os.getcwd() + "/configs/"

import matplotlib.pyplot as plt

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/757797.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号