Ubuntu上的PythonMagick安装

Ubuntu上的PythonMagick安装,python,bash,pythonmagick,Python,Bash,Pythonmagick,我正试图在Ubuntu上安装python库“PythonMagick” 在Windows 10上,我使用了以下链接: 而且效果很好。例如(使用PyCharm和Windows 10),该代码将pdf的每一页转换为图像(jpg): 但是当我在bash中运行相同的程序时,bash说: Platforma_IoT.pdf: 1: Platforma_IoT.pdf: magick: not found Traceback (most recent call last): File "sd.py",

我正试图在Ubuntu上安装python库“PythonMagick”

在Windows 10上,我使用了以下链接:

而且效果很好。例如(使用PyCharm和Windows 10),该代码将pdf的每一页转换为图像(jpg):

但是当我在bash中运行相同的程序时,bash说:

Platforma_IoT.pdf: 1: Platforma_IoT.pdf: magick: not found
Traceback (most recent call last):
  File "sd.py", line 12, in <module>
    subprocess.check_call(["magick","Platforma_IoT.pdf","Platforma_IoT.jpg"], shell=True)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['magick', 'Platforma_IoT.pdf', 'Platforma_IoT.jpg']' returned non-zero exit status 127.
Platforma_IoT.pdf:1:Platforma_IoT.pdf:magick:未找到
回溯(最近一次呼叫最后一次):
文件“sd.py”,第12行,在
子流程检查调用([“magick”、“Platforma_IoT.pdf”、“Platforma_IoT.jpg]”,shell=True)
文件“/usr/lib/python3.6/subprocess.py”,第311行,在check_调用中
引发被调用的进程错误(retcode,cmd)
subprocess.CalledProcessError:命令“['magick'、'Platforma_IoT.pdf'、'Platforma_IoT.jpg']”返回非零退出状态127。
看起来我的bash没有那个库。我怎样才能在Ubuntu上运行这些代码呢?

试试看

import subprocess

subprocess.check_call(["convert","Platforma_IoT.pdf","Platforma_IoT.jpg"])
如果已安装
imagemagick

否则

sudo apt-get update
sudo apt-get install imagemagick --fix-missing
试一试

如果已安装
imagemagick

否则

sudo apt-get update
sudo apt-get install imagemagick --fix-missing

现在bash说:
默认情况下,“文件”的图像格式由其幻数决定。要指定特定的图像格式,请在文件名前加上图像格式名称和克隆(即ps:image),或将图像类型指定为文件名后缀(即image.ps)。为标准输入或输出指定“文件为”-”。Subprocess.CalledProcessError:Command'['convert','Platforma_IoT.pdf','Platforma_IoT.jpg']'返回非零退出状态1。
请先从命令行尝试,因为调用命令不需要python。也许你也需要安装
gs
。我已经安装了ghostscript现在bash说:
默认情况下,“file”的图像格式由它的幻数决定。要指定特定的图像格式,请在文件名前加上图像格式名称和克隆(即ps:image),或将图像类型指定为文件名后缀(即image.ps)。为标准输入或输出指定“文件为”-”。Subprocess.CalledProcessError:Command'['convert','Platforma_IoT.pdf','Platforma_IoT.jpg']'返回非零退出状态1。
请先从命令行尝试,因为调用命令不需要python。也许你也需要安装
gs
。我已经安装了ghostscript