python3.7.2怎么安装不了image_如何使用Python3.7PDF2Image库解决内存错误?

我正在使用Python PDF2Image库运行一个简单的PDF到图像的转换。我当然可以理解这个库正在越过最大内存阈值,从而得出这个错误。但是,the PDF大约是6.6MB,那么为什么抛出一个内存错误要占用GBs的内存呢?在Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.

>>> from pdf2image import convert_from_path

>>> pages = convert_from_path(r'C:\Users\aakashba598\Documents\pwc-annual-report-2017-2018.pdf', 200)

Exception in thread Thread-3:

Traceback (most recent call last):

File "C:\Users\aakashba598\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 917, in _bootstrap_inner

self.run()

File "C:\Users\aakashba598\AppData\Local\Programs\Python\Python37-32\lib\threading.py", line 865, in run

self._target(*self._args, **self._kwargs)

File "C:\Users\aakashba598\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1215, in _readerthread

buffer.append(fh.read())

MemoryError

还有,有什么可能的解决办法呢?在

更新:当我从convert_-from_-path函数中减少dpi参数时,它的工作原理很有魅力。但制作的图片质量很低(原因很明显)。有办法解决这个问题吗?像一批一批的创建图像和清除内存每次。如果有办法,怎么办?在

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值