问题描述
我正在尝试在 上使用 pil 更改 图像 上文本 的方向python3,但我无法这样做,因为未安装 依赖项 libraqm.我找不到安装 libraqm 的方法.
I'm trying to change the direction of text on an image using pil on python3, but I am unable to do so, because the dependency libraqm isn't installed. I can't find a way to install libraqm.
我尝试通过 pip 安装它,但没有成功.
I tried to install it through pip, but it didnt work.
我也试图找到它,我找到了,但是没有关于如何在 Windows 10 上安装它的说明;仅适用于 Mac OS 和 Linux.链接是:https://github.com/HOST-Oman/libraqm/
I also tried to find it, and I did but there are no instructions on how to install it on Windows 10; only on Mac OS and Linux. The link is: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()
加注:
文件C:\Users\Yousef\AppData\Roaming\Python\Python37\site-packages\PIL\ImageFont.py",第 185 行,在 getmask2 中
size, offset = self.font.getsize(text, direction, features, language)
size, offset = self.font.getsize(text, direction, features, language)
KeyError: '设置文本方向、语言或字体功能不是不支持 libraqm'.
KeyError: 'setting text direction, language or font features is not supported without libraqm'.
from PIL import Image, ImageDraw, ImageFont, ImageTk, features
print (features.check('raqm'))
print (Image.PILLOW_VERSION)
返回:
错误
6.0.0
我只是想知道我应该如何安装它?任何帮助将不胜感激,谢谢:)
I'm just wondering on how I should install it? Any help would be much appreciated, thank you :)
推荐答案
Libraqm 也有自己需要安装的依赖项.安装 Libraqm 及其依赖项的最简单方法是使用 vcpkg link
Libraqm also has its own dependencies that need to be installed. The easiest way to install Libraqm and its dependencies is to use vcpkg link
这是一个视频,解释了如何使用 vcpkg 视频
Here's a video that explains to to use vcpkg video
这篇关于安装 Raqm (Libraqm) Windows 10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!