How can I get rid of ft2font import error from matplotlib on a Windows XP source installation?

。_饼干妹妹 提交于 2019-12-11 08:28:13

问题


So today I tried building matplotlib from source (git clone) on a Windows XP box.

First I downloaded and compiled the dependencies (zlib, libpng, freetype2) as per this blog entry. I then edited setup.cfg to make the matplotlib installation aware of the installations of the dependencies. Lastly, python setup.py build and python setup.py install ran without any errors.

But when I try a simple script for a sample plot, I get this error:

  File "C:\Python27\lib\site-packages\matplotlib\font_manager.py", line 53, in <module>
    from matplotlib import ft2font
ImportError: DLL load failed: The specified module could not be found.

Why is this happening, and how can I fix the issue?

EDIT:

I can find a file called ft2font.pyd in the matplotlib folder in the site-packages folder. This file should be able to be imported as per normal, but somehow it doesn't work.


回答1:


I finally figured it out. Opening ft2font.pyd in Dependency Walker showed that libfreetype-6.dll was missing as a dependency. Turns out I had forgot to copy bin\libfreetype-6.dll to the system32 folder. After I'd copied it over matplotlib worked without a hitch.



来源:https://stackoverflow.com/questions/8474419/how-can-i-get-rid-of-ft2font-import-error-from-matplotlib-on-a-windows-xp-source

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!