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中