Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x Wand.image在尝试将pdf转换为.jpeg时出现错误_Python 3.x_Imagemagick_Tesseract_Magickwand - Fatal编程技术网

Python 3.x Wand.image在尝试将pdf转换为.jpeg时出现错误

Python 3.x Wand.image在尝试将pdf转换为.jpeg时出现错误,python-3.x,imagemagick,tesseract,magickwand,Python 3.x,Imagemagick,Tesseract,Magickwand,我正在摄取pdf,以便能够进行OCR。下面的简单代码生成下面提供的操作错误。我已经安装了tesseract、ImageMagick和ghost脚本。我还转到policy.xml并插入 <policy domain="coder" rights="read|write" pattern="PDF" /> 我做错了什么。提前谢谢 from wand.image import Image as wi from pathli

我正在摄取pdf,以便能够进行OCR。下面的简单代码生成下面提供的操作错误。我已经安装了tesseract、ImageMagick和ghost脚本。我还转到policy.xml并插入

<policy domain="coder" rights="read|write" pattern="PDF" />

我做错了什么。提前谢谢

from wand.image import Image as wi

from pathlib import Path
root_folder = Path("""C:/Users/DS_01/Documents/Mikes_Home/TBM Actual Run/Contracts/discard""")
file = 'SBAHQ19PRZ0061_SBAATTACH9504080EQ0059_A10.PDF'
doc_path = root_folder/file

pdf = wi(filename = doc_path, resolution = 300)




 Traceback (most recent call last):

  File "<ipython-input-27-f3ee3a36d338>", line 8, in <module>
    pdf = wi(filename = doc_path, resolution = 300)

  File "C:\Users\DS_01\AppData\Roaming\Python\Python37\site-packages\wand\image.py", line 8616, in __init__
    wand = library.NewMagickWand()

OSError: exception: access violation writing 0x0000000000000008
从wand.image导入图像作为wi
从pathlib导入路径
根文件夹=路径(“C:/Users/DS\U 01/Documents/Mikes\u Home/TBM实际运行/合同/放弃”)
文件='SBAHQ19PRZ0061_SBAATTACH9504080EQ0059_A10.PDF'
文档路径=根文件夹/文件
pdf=wi(文件名=doc\u路径,分辨率=300)
回溯(最近一次呼叫最后一次):
文件“”,第8行,在
pdf=wi(文件名=doc\u路径,分辨率=300)
文件“C:\Users\DS\u 01\AppData\Roaming\Python37\site packages\wand\image.py”,第8616行,在uu init中__
wand=library.NewMagickWand()
操作错误:异常:访问冲突写入0x0000000000000008

更新:通过卸载Imagemagick并安装不同版本解决了此问题。

定义环境变量
MAGICK\u OCL\u DEVICE=OFF
应该可以解决此问题。最新的ImageMagick和NVIDIA的OpenCL驱动程序之间似乎存在问题。