- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
导入时间长得令人无法接受:
from matplotlib import pylab as plt --> 3.0124739 secs
这是 cProfile 的输出,它清楚地表明问题出在 afm.py,它是 Adobe Font Metrics. 的一些接口(interface). Matplotlib 版本为 1.4.0 - Ubuntu 14.04
5994612 function calls (5992123 primitive calls) in 4.702 seconds
Ordered by: internal time
ncalls tottime percall cumtime percall filename:lineno(function)
182 1.589 0.009 2.372 0.013 afm.py:220(_parse_kern_pairs)
215 0.746 0.003 1.420 0.007 afm.py:180(_parse_char_metrics)
1297990 0.410 0.000 0.410 0.000 {method 'split' of 'str' objects}
839978 0.288 0.000 0.288 0.000 {method 'readline' of 'file' objects}
2 0.254 0.127 4.185 2.093 font_manager.py:544(createFontList)
843308 0.170 0.000 0.170 0.000 {method 'startswith' of 'str' objects}
114276 0.168 0.000 0.205 0.000 afm.py:72(_to_list_of_floats)
1563800 0.125 0.000 0.125 0.000 {len}
839220 0.117 0.000 0.117 0.000 {method 'rstrip' of 'str' objects}
115290 0.116 0.000 0.119 0.000 {method 'decode' of 'str' objects}
117775 0.086 0.000 0.086 0.000 afm.py:56(_to_int)
20 0.061 0.003 0.061 0.003 {built-in method poll}
520 0.040 0.000 0.040 0.000 {method 'get_sfnt' of 'FT2Font' objects}
6910 0.036 0.000 0.036 0.000 {posix.stat}
3372 0.025 0.000 0.038 0.000 posixpath.py:336(normpath)
知道如何修复/禁用它吗?
编辑:
回滚到 1.3.1 拯救了我。运行时间现在为 0.2 秒。
最佳答案
我遇到了同样的问题。我发现,当您将 matplotlib
升级到较新版本时会发生这种情况。字体缓存文件与新版本不兼容,但显然没有重新创建。相反,字体列表是每次即时创建的。解决方案是删除matplotlib缓存目录(在我的例子中是~/.cache/matplotlib
)
关于python - 导入 matplotlib afm 速度极慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26421364/
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想要改善这个问题吗?更新问题,以便将其作为on-topi
我有一个启用了 apm 的应用程序,对 apm sdk 的唯一引用位于 package.json 依赖项和 app.js 中。我有以下行: const apm = require('elastic-a
我正在尝试使用 extrafonts 包。当我导入字体时,我收到许多警告。当我尝试使用 pdf() 命令中的字体时,我收到许多有关未知 AFM 实体的警告。我看过许多帖子建议从 AFM 文件中删除版权
导入时间长得令人无法接受: from matplotlib import pylab as plt --> 3.0124739 secs 这是 cProfile 的输出,它清楚地表明问题出在 af
pdfkit-www 是一个很棒的图书馆。它使您能够直接从浏览器输出 pdf。 查看演示:http://ef4.github.com/pdfkit-www/demo.html 从演示中,我获取了 pd
我在使用 apache PDFBox jar 时遇到错误。看起来好像它正在调用 AFMParser 类上不存在的方法。 AFAIK我已经正确包含了fontbox。 pdfbox、fontbox、com
我是一名优秀的程序员,十分优秀!