Open pendave opened 7 years ago
为毛我看了这里的解决方法 改成 D:/Program Files/wkhtmltopdf/bin/
I found the solution, I don't know why but python was replacing my environment path "C:\Program Files\wkhtmltopdf\bin" with "C:\Program Files\wkhtmltopdin" because of "\b" so I just replaced "\b" with "/b" and solved.
http://stackoverflow.com/questions/41631479/python-pdfkit-cant-find-wkhtmltopdf-executable 还搞不对?
我问的是这里怎么改? 避免 \b
PATH 环境变量里设置的路径里有 \bin
或者 \b
D:\Program Files\wkhtmltopdf\bin\
老外说
Make sure that you have wkhtmltopdf in your PATH. where wkhtmltopdf in Windows or which wkhtmltopdf on Linux should return actual path to binary.
被处理成了二进制的
那这个环境变量怎么写才对呢?
我也是用下面这段代码才成功解决问题,一直改环境变量也没用,一直提示错误...
config = pdfkit.configuration(wkhtmltopdf=r"D:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe") pdfkit.from_file(htmls, file_name, options=options, configuration=config)
不知是否还有其他方法呢?
OSError: No wkhtmltopdf executable found: "b''"
那个报错 我环境变量里加的是
D:\Program Files\wkhtmltopdf\bin\
以为是\b这个在python里解析出错的造成的,于是去改成D:\\Program Files\\wkhtmltopdf\\bin\\
还是不行。 我参考了老外的问答 http://stackoverflow.com/questions/27673870/cant-create-pdf-using-python-pdfkit-error-no-wkhtmltopdf-executable-found 改成就可以正常运行了
请问只能这样处理吗?