2014-10-31 97 views
2

我使用Windows 7 64位,我想安裝和使用freetype(從https://pypi.python.org/pypi/freetype-py)。我在我的winpython 2.6中安裝了gnu32 freetype6.dll和freetype-py。當我在我的Python代碼導入的FreeType,系統說:如何安裝蟒蛇freetype在Windows 7

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

然後,我刪除了的FreeType,並使用PIP安裝FreeType的1.0。當我編譯的代碼,系統說:

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 

我不能使用PIP安裝FreeType 2的庫結合,它說:無法找到符合要求的Freetype任何下載。

於是,我打開__init__.py,並改變

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

到:

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

不過,這是行不通的;系統說:

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

有人可以幫助解決這個問題嗎?我真的需要使用freetype。

回答

2

根據安裝指南,它聲明你需要freetype 2(下面複製)。因此,您的PIP安裝與自由類型1將無法工作。

Freetype-py 0.5.1

Installation

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

爲了進一步明確,當你說:「我已經安裝了gnu32 freetype6.dll」,你有沒有嘗試自己編譯的二進制文件或根據安裝指南下載安裝程序?

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

+0

是的,我在這裏下載的FreeType對於Windows:http://gnuwin32.sourceforge.net/packages/freetype.htm。至於freetype 2 libaray,我找不到它。 – 2014-10-31 18:58:27

+0

現在,我設法讓系統知道從哪裏得到freetype.dll,但是當我在我的python代碼中導入freetype時,系統說: __dll__ = ctypes.CDLL(FT_Library_filename) 文件「C:\ WinPython-32bit -2.7.6.4 \ python-2.7.6 \ lib \ ctypes \ __ init__.py「,行365,在__init__中 self._handle = _dlopen(self._name,mode) WindowsError:[錯誤126]指定的模塊不能被發現。 看來,系統不能在ctypes中使用CDLL,我不知道如何解決它。它適用於我的贏家7家庭高級機器。 謝謝。 – 2014-11-05 14:50:20