- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试绘制一个条形图。但它显示运行时错误,并在 FT2Font 中显示:无法加载面部。在波顿。我试过卸载并重新安装。又试了另一种方法,还是不行。我认为代码是正确的,因为我在 Windows 笔记本电脑上成功运行了它。我的 jupyter notebook 适用于 Mac python 2.7。
代码如下:
import numpy as np
import pandas as pd
obj = pd.Series([4, 7, -5, 3])
print type(obj)
obj
%matplotlib inline
obj.plot(kind = 'bar', figsize=[5,4])
但它显示了一些错误:
<matplotlib.axes._subplots.AxesSubplot at 0x1114e69d0>
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/anaconda2/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
332 pass
333 else:
--> 334 return printer(obj)
335 # Finally look for special method names
336 method = get_real_method(obj, self.print_method)
/anaconda2/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in <lambda>(fig)
238
239 if 'png' in formats:
--> 240 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
241 if 'retina' in formats or 'png2x' in formats:
242 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
/anaconda2/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in print_figure(fig, fmt, bbox_inches, **kwargs)
122
123 bytes_io = BytesIO()
--> 124 fig.canvas.print_figure(bytes_io, **kw)
125 data = bytes_io.getvalue()
126 if fmt == 'svg':
/anaconda2/lib/python2.7/site-packages/matplotlib/backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2206 orientation=orientation,
2207 dryrun=True,
-> 2208 **kwargs)
2209 renderer = self.figure._cachedRenderer
2210 bbox_inches = self.figure.get_tightbbox(renderer)
/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in print_png(self, filename_or_obj, *args, **kwargs)
505
506 def print_png(self, filename_or_obj, *args, **kwargs):
--> 507 FigureCanvasAgg.draw(self)
508 renderer = self.get_renderer()
509 original_dpi = renderer.dpi
/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in draw(self)
428 if toolbar:
429 toolbar.set_cursor(cursors.WAIT)
--> 430 self.figure.draw(self.renderer)
431 finally:
432 if toolbar:
/anaconda2/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
/anaconda2/lib/python2.7/site-packages/matplotlib/figure.pyc in draw(self, renderer)
1293
1294 mimage._draw_list_compositing_images(
-> 1295 renderer, self, artists, self.suppressComposite)
1296
1297 renderer.close_group('figure')
/anaconda2/lib/python2.7/site-packages/matplotlib/image.pyc in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
/anaconda2/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_base.pyc in draw(self, renderer, inframe)
2397 renderer.stop_rasterizing()
2398
-> 2399 mimage._draw_list_compositing_images(renderer, self, artists)
2400
2401 renderer.close_group('axes')
/anaconda2/lib/python2.7/site-packages/matplotlib/image.pyc in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
/anaconda2/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
/anaconda2/lib/python2.7/site-packages/matplotlib/axis.pyc in draw(self, renderer, *args, **kwargs)
1133 ticks_to_draw = self._update_ticks(renderer)
1134 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
-> 1135 renderer)
1136
1137 for tick in ticks_to_draw:
/anaconda2/lib/python2.7/site-packages/matplotlib/axis.pyc in _get_tick_bboxes(self, ticks, renderer)
1073 for tick in ticks:
1074 if tick.label1On and tick.label1.get_visible():
-> 1075 extent = tick.label1.get_window_extent(renderer)
1076 ticklabelBoxes.append(extent)
1077 if tick.label2On and tick.label2.get_visible():
/anaconda2/lib/python2.7/site-packages/matplotlib/text.pyc in get_window_extent(self, renderer, dpi)
968 raise RuntimeError('Cannot get window extent w/o renderer')
969
--> 970 bbox, info, descent = self._get_layout(self._renderer)
971 x, y = self.get_unitless_position()
972 x, y = self.get_transform().transform_point((x, y))
/anaconda2/lib/python2.7/site-packages/matplotlib/text.pyc in _get_layout(self, renderer)
352 tmp, lp_h, lp_bl = renderer.get_text_width_height_descent('lp',
353 self._fontproperties,
--> 354 ismath=False)
355 offsety = (lp_h - lp_bl) * self._linespacing
356
/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in get_text_width_height_descent(self, s, prop, ismath)
233
234 flags = get_hinting_flag()
--> 235 font = self._get_agg_font(prop)
236 font.set_text(s, 0.0, flags=flags) # the width and height of unrotated string
237 w, h = font.get_width_height()
/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in _get_agg_font(self, prop)
270 font = get_font(
271 fname,
--> 272 hinting_factor=rcParams['text.hinting_factor'])
273
274 font.clear()
/anaconda2/lib/python2.7/site-packages/backports/functools_lru_cache.pyc in wrapper(*args, **kwds)
135 stats[HITS] += 1
136 return result
--> 137 result = user_function(*args, **kwds)
138 with lock:
139 root, = nonlocal_root
RuntimeError: In FT2Font: Can not load face.
<matplotlib.figure.Figure at 0x1114e6290>
我试过卸载它。和另一个代码:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
obj = pd.Series([4, 7, -5, 3])
print type(obj)
obj
plt.plot(obj)
plt.show()
仍然显示错误:
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/anaconda2/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
332 pass
333 else:
--> 334 return printer(obj)
335 # Finally look for special method names
336 method = get_real_method(obj, self.print_method)
/anaconda2/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in <lambda>(fig)
238
239 if 'png' in formats:
--> 240 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
241 if 'retina' in formats or 'png2x' in formats:
242 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
/anaconda2/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in print_figure(fig, fmt, bbox_inches, **kwargs)
122
123 bytes_io = BytesIO()
--> 124 fig.canvas.print_figure(bytes_io, **kw)
125 data = bytes_io.getvalue()
126 if fmt == 'svg':
/anaconda2/lib/python2.7/site-packages/matplotlib/backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2206 orientation=orientation,
2207 dryrun=True,
-> 2208 **kwargs)
2209 renderer = self.figure._cachedRenderer
2210 bbox_inches = self.figure.get_tightbbox(renderer)
/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in print_png(self, filename_or_obj, *args, **kwargs)
505
506 def print_png(self, filename_or_obj, *args, **kwargs):
--> 507 FigureCanvasAgg.draw(self)
508 renderer = self.get_renderer()
509 original_dpi = renderer.dpi
/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in draw(self)
428 if toolbar:
429 toolbar.set_cursor(cursors.WAIT)
--> 430 self.figure.draw(self.renderer)
431 finally:
432 if toolbar:
/anaconda2/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
/anaconda2/lib/python2.7/site-packages/matplotlib/figure.pyc in draw(self, renderer)
1293
1294 mimage._draw_list_compositing_images(
-> 1295 renderer, self, artists, self.suppressComposite)
1296
1297 renderer.close_group('figure')
/anaconda2/lib/python2.7/site-packages/matplotlib/image.pyc in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
/anaconda2/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_base.pyc in draw(self, renderer, inframe)
2397 renderer.stop_rasterizing()
2398
-> 2399 mimage._draw_list_compositing_images(renderer, self, artists)
2400
2401 renderer.close_group('axes')
/anaconda2/lib/python2.7/site-packages/matplotlib/image.pyc in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
/anaconda2/lib/python2.7/site-packages/matplotlib/artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
/anaconda2/lib/python2.7/site-packages/matplotlib/axis.pyc in draw(self, renderer, *args, **kwargs)
1133 ticks_to_draw = self._update_ticks(renderer)
1134 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
-> 1135 renderer)
1136
1137 for tick in ticks_to_draw:
/anaconda2/lib/python2.7/site-packages/matplotlib/axis.pyc in _get_tick_bboxes(self, ticks, renderer)
1073 for tick in ticks:
1074 if tick.label1On and tick.label1.get_visible():
-> 1075 extent = tick.label1.get_window_extent(renderer)
1076 ticklabelBoxes.append(extent)
1077 if tick.label2On and tick.label2.get_visible():
/anaconda2/lib/python2.7/site-packages/matplotlib/text.pyc in get_window_extent(self, renderer, dpi)
968 raise RuntimeError('Cannot get window extent w/o renderer')
969
--> 970 bbox, info, descent = self._get_layout(self._renderer)
971 x, y = self.get_unitless_position()
972 x, y = self.get_transform().transform_point((x, y))
/anaconda2/lib/python2.7/site-packages/matplotlib/text.pyc in _get_layout(self, renderer)
352 tmp, lp_h, lp_bl = renderer.get_text_width_height_descent('lp',
353 self._fontproperties,
--> 354 ismath=False)
355 offsety = (lp_h - lp_bl) * self._linespacing
356
/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in get_text_width_height_descent(self, s, prop, ismath)
233
234 flags = get_hinting_flag()
--> 235 font = self._get_agg_font(prop)
236 font.set_text(s, 0.0, flags=flags) # the width and height of unrotated string
237 w, h = font.get_width_height()
/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in _get_agg_font(self, prop)
270 font = get_font(
271 fname,
--> 272 hinting_factor=rcParams['text.hinting_factor'])
273
274 font.clear()
/anaconda2/lib/python2.7/site-packages/backports/functools_lru_cache.pyc in wrapper(*args, **kwds)
135 stats[HITS] += 1
136 return result
--> 137 result = user_function(*args, **kwds)
138 with lock:
139 root, = nonlocal_root
RuntimeError: In FT2Font: Can not load face.
<matplotlib.figure.Figure at 0x113232250>
最佳答案
我在 MacOS 上使用 anaconda 和 spyder 以及 python 3+ 时遇到了同样的问题。我不确定此解决方案是否适合您,但我通过删除以下位置的所有文件和文件夹解决了这个问题:
/Users/YOUR_USER/.matplotlib
然后在 Anaconda Navigator 中从我的环境中卸载并重新安装 'matplotlib'。
关于python - 在 FT2Font : Can not load face,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48603413/
大家好,我正在使用 OpenCV(Python)开发人脸识别程序。我有两个文件,一个可以捕捉新用户的脸并按用户提供的名称存储它。第二个文件识别使用网络摄像头的用户。现在,我担心的是用户被正确识别,但名
一般来说,我的字体工作正常,但我偶尔会看到一些奇怪的情况,例如从另一个应用程序切换回浏览器,有时当从另一个选项卡切换回时,我的字体似乎已经卸载并正在使用后备字体。 我正在努力始终如一地复制它,当我看到
我经常在我开发的网站中嵌入 webfont (@font-face),直到今天我才遇到过重大问题。 其实我觉得line-height有很大的问题,我英文不是特别好所以我尽量用图来说明。我已经联系了 f
屏幕截图很棒,但没有呈现自定义 @font-face 字体。是否有可能纠正这一点? 最佳答案 在做了一些研究之后,我发现了这个 http://code.google.com/p/phantomjs/i
所以我有一个字体,我最近在几个网站上使用了它,叫做 Kondolar。这是一种可爱的字体,我实际上使用了 4 种字体粗细,所以在我的样式表中实际上有 4 个 @font-face 定义,每个定义都有自
非常感谢:)请找到完整的代码 导入boto3 s3_client = boto3.client('s3', aws_access_key_id='xxxxxxxxxxxxxxx', aws_secre
这不是以下的骗局:Can we test Face ID in simulator? 我想知道如何测试用户何时接受下面的 Face ID 警告,上面写着“你想允许“应用程序”使用 Face ID”,然
我需要检测 iPhone 朝向哪个方向,以便在掉落时从无障碍摄像头(正面或背面)进行录制。 这将在紧急情况下使用,手机掉落或放置在事件摄像头没有记录任何有值(value)内容的情况下。 我可以使用什么
我有一个需要 Trade Gothic 的网站。我想知道将 @font-face 或 cufon 与看起来类似于 Trade Gothic 的字体一起使用还是只是使用图像路线是更好的做法。显然,使用图
我在使用 Microsoft Face API 时遇到问题。以下是我的示例请求: curl -v -X POST "https://westus.api.cognitive.microsoft.com
我有一个在图像上运行并识别人脸并返回如下列表的脚本: [('Mike', (142, 464, 365, 241)),('Garry', (42, 364, 65, 141)),('unknown',
我有一个网络服务,可以重写 css 文件中的 url,以便可以通过 CDN 提供它们。 css 文件可以包含图像或字体的 url。 我目前有以下正则表达式来匹配 css 文件中的所有 url: (ur
我在乱用 @font-face 并且得到了一些奇怪的结果。我下载并安装了字体,它像它应该的那样安装在/Users/myuser/Library/Fonts 中(我想!?)。奇怪的是,无论我在 CSS
JSF 2 的 Mojarra 实现具有以下上下文参数: com.sun.faces.numberOfViewsInSession(默认为 15) com.sun.faces.numberOfLogi
jsf-api.jar 包含各种本地化的 Messages.properties 文件,这些文件一方面包含 javax.faces.component.UIInput.CONVERSION 键,另一方
谁能介绍一下 Liferay Faces 和 JSF 连接。就像我无法理解 Liferay 人脸在以下场景中的作用。 JSF ----> Model View Controller Spr
我正在尝试使用我的字体的“较轻”版本,但在 firefox 和 chrome 中它仍然显示为“正常”粗细。 这是我的 font.css: @font-face { font-family: Aveni
尝试访问应用程序时出现以下JavaScript错误。 Uncaught SyntaxError: Unexpected token 和的正常运行是必需的)。 您可能已经知道HTML文档通常通常以<和J
在我的应用程序中,我想对 UIImage 使用人脸检测,所以我使用库中的 CoreImage 构建(我知道 Vision Library 也是最新的人脸检测库。但它仅支持 ios 11.0 及以上)。
我需要从 Stylus 获得以下 CSS 输出(这是一种落后的方式,但 Stylus 将使该元素的许多其他部分变得更容易)。我已经尝试了很多东西,但无法编译,当它说它已经编译时,这部分输出没有任何显示
我是一名优秀的程序员,十分优秀!