安装 Raqm (Libraqm) Windows 10

You*_*efZ 6 python installation dependencies python-imaging-library python-3.x

我正在尝试使用python3上的pil更改图像文本方向,但我无法这样做,因为未安装依赖项libraqm 。我找不到安装libraqm 的方法。


我尝试通过pip安装,但是没有成功。

我也尝试找到它,我找到了,但是没有关于如何在Windows 10上安装它的说明;仅适用于 Mac 操作系统和 Linux。链接是: https: //github.com/HOST-Oman/libraqm/


from PIL import Image, ImageDraw, ImageFont, ImageTk, features


Coords = [0,0]
Text = 'Hello World'
colour = '#225643'
Font = ImageFont.truetype("Font/GentiumBasic-Regular.ttf", 40, 
                                 encoding="unic"))

direction = 'rtl' #Right to Left
Alignment= 'right'

til = Image.new("RGBA", (800, 500))
draw = ImageDraw.Draw(til)
draw.text(Coords, Text, colour, font=Fonts, 
                  align=Alignment, direction=direction)
til.show()
Run Code Online (Sandbox Code Playgroud)

加薪:

文件“C:\Users\Yousef\AppData\Roaming\Python\Python37\site-packages\PIL\ImageFont.py”,第 185 行,在 getmask2 中

大小,偏移量= self.font.getsize(文本,方向,特征,语言)

KeyError:“如果没有 libraqm,则不支持设置文本方向、语言或字体功能”。


from PIL import Image, ImageDraw, ImageFont, ImageTk, features
print (features.check('raqm'))
print (Image.PILLOW_VERSION)
Run Code Online (Sandbox Code Playgroud)

返回:

错误的

6.0.0

我只是想知道我应该如何安装它?任何帮助将不胜感激,谢谢:)

Fre*_*a W 5

不实际安装 libraqm 而是让它在 python / PIL 中工作的最简单方法是:

  • 从这里下载非官方构建 dll (搜索“libraqm”)
  • 将它们复制到与您的目录相同的目录中python.exe

重新启动内核,它应该可以工作。


Tim*_*ton 3

Libraqm 也有自己的依赖项需要安装。安装 Libraqm 及其依赖项的最简单方法是使用 vcpkg链接

这是一个解释如何使用 vcpkg视频的视频

  • 如果有人确实想自己构建libraqm(没有vcpkg),我建议使用cmake(https://github.com/HOST-Oman/libraqm-cmake) (2认同)