想使用python将几张图片合成pdf,在pypi上找到了img2pdf,按照例子
import img2pdf
# opening from filename
with open("name.pdf","wb") as f:
f.write(img2pdf.convert('test.jpg'))
运行时提示:
AttributeError: module 'img2pdf' has no attribute 'convert'
这是怎么回事啊
想使用python将几张图片合成pdf,在pypi上找到了img2pdf,按照例子
import img2pdf
# opening from filename
with open("name.pdf","wb") as f:
f.write(img2pdf.convert('test.jpg'))
运行时提示:
AttributeError: module 'img2pdf' has no attribute 'convert'
这是怎么回事啊
刚才尝试了一下,可以正常使用,有convert函数,你是不是本地py文件叫img2pdf.py 吧,导致导入的不是内置库~