freetype-py 安装

首先直接
pip install freetype-py

这时如果直接 import freetype 会报错:

XXX\freetype\raw.py", line 34, in <module>
    _lib = ctypes.CDLL(filename)
  File "C:\Python36\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] 找不到指定的模块。

其实是没有找到freetype.dll导致的。去https://github.com/ubawurinna/freetype-windows-binaries下载自己对应版本的freetype.dll 然后拷贝到XXX\freetype\文件夹下,打开raw.py文件,定位到30行修改为:

filename = "C:\\Python36\\Lib\\site-packages\\freetype\\freetype.dll"

猜你喜欢

转载自blog.csdn.net/qq_36810544/article/details/80057474