[英]Can't add custom font to python with fpdf on linux
我在我的 windows 機器上用fpdf2
為 python 開發了一個軟件。它工作得很好,但現在我必須在 Red Hat Linux 服務器上安裝這個程序,當我嘗試將自定義字體添加到 pdf 時,它會拋出一個錯誤: cannot instantiate 'WindowsPath' on your system
代碼:
pdf = FPDF()
FONT_REGULAR = os.path.join(os.path.dirname(__file__), "fonts", "arial.ttf")
pdf.add_font("Regular", "", FONT_REGULAR, uni=True)
在這一行它拋出一個錯誤:
<NotImplementedError> "cannot instantiate 'WindowsPath' on your system"
有解決方法嗎?
fpdf2 版本:2.4.5
升級到最新版本2.5.1
,它也適用於 linux。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.