[英]Python - How to install font on AWS Lambda?
我正在嘗試在 AWS Lambda 上安裝字體以使用 Moviepy 的 TextClip() function。 我一步一步跟着這個答案https://stackoverflow.com/a/51622335/6673340 ,但字體仍然不想安裝......
我的部署 package 中有以下文件和目錄:
這是我的 fonts.conf:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/opt/fonts/</dir>
<cachedir>/tmp/fonts-cache/</cachedir>
<config></config>
</fontconfig>
我還補充說: FONTCONFIG_PATH=/opt/fonts
但我仍然收到以下錯誤:
[ERROR] OSError: MoviePy Error: creation of None failed because of the following error:
convert: unable to read font `Rubik-Regular' @ warning/annotate.c/RenderType/955.
convert: delegate library support not built-in 'Rubik-Regular' (Freetype) @ warning/annotate.c/RenderFreetype/1808.
convert: no images defined `PNG32:/tmp/tmp3h8xrg3n.png' @ error/convert.c/ConvertImageCommand/3300
你們中的任何一個都知道為什么這對我不起作用嗎?
/var/task is the directory where you codebase lives as per lambda convention
so as per your current structure i think FONTCONFIG_PATH=/var/task/fonts
and font.conf should be
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/var/task/fonts/</dir>
<cachedir>/tmp/fonts-cache/</cachedir>
<config></config>
</fontconfig>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.