一個解決python模塊blabel調(diào)用失敗方法(weasyprint模塊調(diào)用失敗)
?Github blabel項目說明看到其實依賴WeasyPrint,仔細查看錯誤也能看錯是由WeasyPrint找不到DLL而引發(fā)的報錯,查閱資料可定位是在Windows找不到gtk的依賴造成的。
報錯點位 關(guān)鍵字?:WeasyPrint==59 ?python3.11.4
報錯點位?關(guān)鍵字? ?:WeasyPrint==52 ?python3.11.4
網(wǎng)上已經(jīng)有解決方案可嘗試,但奈何網(wǎng)絡好像不給力,根本沒有辦法下載到github tschoonj/GTK-for-Windows-Runtime-Environment-Installer所需的運行庫exe。
又找了一遍,尋找到了鏡像站點,下載到了開發(fā)運行庫2022-01-04 Source code?(zip),看到內(nèi)部有很多DLL并且正好與其他人符合,這里改變了下思路,提取出bin文件夾,并給操作系統(tǒng)增加環(huán)境變量。
GTK運行庫鏡像站點:https://gitcode.net/mirrors/tschoonj/GTK-for-Windows-Runtime-Environment-Installer
bin文件夾在壓縮包的路徑:GTK-for-Windows-Runtime-Environment-Installer-2022-01-04\gtk-nsis-pack\bin\。
很可惜的是依舊是失敗的,查詢資料意識到個問題,python 會存在依賴問題,切換到python-3.8.10,WeasyPrint調(diào)用關(guān)聯(lián)錯誤消失,blabel模塊也能正常的調(diào)用。
總結(jié)python-3.8.10、WeasyPrin==59,blabel==0.1.6正常使用,終于可見不到這些紅色字體啦!

附錄:
blabel鏈接:https://github.com/Edinburgh-Genome-Foundry/blabel
Blabel?pypi 鏈接:https://pypi.org/project/blabel/
GTK運行庫:https://gitcode.net/mirrors/tschoonj/GTK-for-Windows-Runtime-Environment-Installer
GTK運行庫鏡像站點:https://gitcode.net/mirrors/tschoonj/GTK-for-Windows-Runtime-Environment-Installer
解決方案參考:https://blog.csdn.net/weixin_43341137/article/details/115921248