How to install python freetype in windows 7

Tao Gong picture Tao Gong · Oct 31, 2014 · Viewed 7.4k times · Source

I am using Windows 7 64bit, I want to install and use freetype (from https://pypi.python.org/pypi/freetype-py). I have installed gnu32 freetype6.dll, and freetype-py in my winpython 2.6. When I import freetype in my python code, the system said:

raise RuntimeError('Freetype library not found')
RuntimeError: Freetype library not found 

Then, I deleted the freetype, and used pip to install freetype 1.0. When I compiled the code, the system said:

import freetype as FT
  File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\freetype\__init__.py", line 33, in <module>
    if not FT_Library_filename:
NameError: name 'FT_Library_filename' is not defined

I cannot use pip to install Freetype 2 library binding, it said: could not find any downloads that satisfy the requirement Freetype.

Then, I opened __init__.py, and changed

FT_Library_filename = ctypes.util.find_library('freetype')

into:

FT_library_filename = "C:\Program Files (x86)\GnuWin32\bin\freetype.dll"

Still, it does not work; the system said:

if not FT_Library_filename:
NameError: name 'FT_Library_filename' is not defined

Can someone help correct this? I really need to use freetype.

Answer

ETam picture ETam · Oct 31, 2014

According to the installation guide, it states you need freetype 2 (copied below). So your PIP installation with free type 1 would not have worked.

Freetype-py 0.5.1

Installation

To be able to use freetype python, you need the freetype library version 2 installed on your system.

To help clarify, when you said "I have installed gnu32 freetype6.dll", did you try to compile your own binaries or download the installer according to the installation guide?

http://gnuwin32.sourceforge.net/install.html