我试着在我的windows 8机器上安装pdfkit Python API。我遇到了和path有关的问题。
Traceback (most recent call last):
File "C:\Python27\pdfcre", line 13, in <module>
pdfkit.from_url('http://google.com', 'out.pdf')
File "C:\Python27\lib\site-packages\pdfkit\api.py", line 22, in from_url
configuration=configuration)
File "C:\Python27\lib\site-packages\pdfkit\pdfkit.py", line 38, in __init__
self.configuration = (Configuration() if configuration is None
File "C:\Python27\lib\site-packages\pdfkit\configuration.py", line 27, in __init__
'https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf' % self.wkhtmltopdf)
IOError: No wkhtmltopdf executable found: ""
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
有人在windows机器上安装了Python PDFKIt吗?如何解决此错误。
我的示例代码:
import pdfkit
import os
config = pdfkit.configuration(wkhtmltopdf='C:\\Python27\\wkhtmltopdf\bin\\wkhtmltopdf.exe')
pdfkit.from_url('http://google.com', 'out.pdf')
请使用安装wkhtmltoppdf
对于windows计算机,请从下面的链接http://wkhtmltopdf.org/downloads.html安装它
您需要将
wkhtmltopdf
路径添加到环境变量中在不需要修改windows环境变量的情况下,应执行以下操作:
当然,假设路径是正确的(例如,在我的例子中,它是r'C:\程序文件(x86)\ wkhtmltopf\bin\wkhtmltopf.exe')。
IOError: 'No wkhtmltopdf executable found'
确保您的$PATH中有wkhtmltopfd或通过自定义配置进行设置。
where wkhtmltopdf
在Windows或which wkhtmltopdf
在Linux上应该返回二进制文件的实际路径。添加此配置行对我有效:
From github
似乎你需要把
configuration=config
作为参数。相关问题 更多 >
编程相关推荐