1、pdfkit安装
pip3 install pdfkit
2、python使用pdfkit中,调用pdfkit.from_string等,就会出现以下错误。而且如果你使用pip install wkhtmltopdf,安装完还是会出现这个问题
OSError at /xxx/xxx/xxx/xxx/export/
No wkhtmltopdf executable found: "b''"
If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf
3、直接下载wkhtmltopdf可执行文件
下载地址:
https://wkhtmltopdf.org/downloads.html
根据操作系统的类型下载
这里下载的是centos7
wkhtmltox-0.12.6-1.centos7.x86_64
4、wkhtmltopdf安装
例如centos7系统
rpm -ivh wkhtmltox-0.12.6-1.centos7.x86_64
可能会缺少依赖包
yum install xorg-x11-fonts-75dpi
yum install xorg-x11-fonts-Type1
windows系统安装完
把安装目录(C:\Program Files\wkhtmltopdf)添加到环境变量path中
本文详细介绍如何解决Python PDFKit模块在安装及使用过程中遇到的问题,包括安装wkhtmltopdf可执行文件,针对不同操作系统(如CentOS7和Windows)的具体步骤,并确保PDFKit能够正常工作。
1149

被折叠的 条评论
为什么被折叠?



