Matplotlib 找不到 Facefile,正在使用旧的 Python 解释器位置
我有一个利用 Matplotlib 库的脚本,该脚本在家里和大学实验室中运行良好,但当我尝试在工作计算机上运行它时遇到问题。
最初,我是从 USB 记忆棒运行解释器 - 没有问题 - 但我最近将解释器复制到硬盘驱动器以节省混乱,现在如果我在没有 USB 的情况下运行脚本坚持下去,我收到以下严重错误(为便于阅读而添加了空格):
# lots of Traceback trimmed off here
File "d:\Python2.6.5\lib\site-packages\matplotlib\backends\backend_agg.py",
line 221, in _get_agg_font
font = FT2Font(str(fname))
RuntimeError: Could not open facefile F:\Apps\Python2.6.5\lib\site-packages\
matplotlib\mpl-data\fonts\ttf\Vera.ttf; Cannot_Open_Resource
正如您所期望的,如果我将 USB 记忆棒与解释器连接起来,它将正常工作。
显然,该库在某处有一个配置,将其指向旧的 USB 位置。
此配置数据保存在哪里和/或如何修复此问题?
I've a script that utilised the Matplotlib library, the script works fine at home and in the Uni labs, but I have an issue when I try and run it on my work machine.
Originally, I was running the interpreter from my USB stick - no problems there - but I've recently copied the interpreter to the hard drive to save messing around, and now if I run the script without my USB stick in I get the following critical error (with spacing added for readability):
# lots of Traceback trimmed off here
File "d:\Python2.6.5\lib\site-packages\matplotlib\backends\backend_agg.py",
line 221, in _get_agg_font
font = FT2Font(str(fname))
RuntimeError: Could not open facefile F:\Apps\Python2.6.5\lib\site-packages\
matplotlib\mpl-data\fonts\ttf\Vera.ttf; Cannot_Open_Resource
As you would expect, it will work fine if I connect my USB stick with the interpreter on it.
Clearly somewhere, the library has a configuration somewhere that points it to the old USB location.
Where is this configuration data kept and/or how do I fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
matplotlib 将其配置文件保存在 .matplotlib 目录中 查找目录
更改 MPLCONFIGDIR 环境变量以更改目录位置。
matplotlib keeps it's config file in the .matplotlib directory finding the location of the directory
Change the MPLCONFIGDIR environment variable to change the directory location.