在做html转pdf时出现这个问题,raise IOError('No wkhtmltopdf executable found: "%s"\n'
OSError: No wkhtmltopdf executable found: "b'D:\\ruanjian1\\html\xd7\xaapdf\\wkhtmltopdf\\bin\\wkhtmltopdf.exe'"
If this file exists please check that this process can read it or you can pass path to it manually in method call, check README. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Install
解决办法
加上
path_wk = r'D:\ruanjian1\html转pdf\wkhtmltopdf\bin\wkhtmltopdf.exe' #wkhtmltopdf安装位置 config = pdfkit.configuration(wkhtmltopdf = path_wk)
其中path_wk为wkhtmltopdf安装路径。之后在使用时加上configuration=config
pdfkit.from_url('http://baidu.com','out.pdf',configuration=config)