我正在尝试在Ubuntu上安装python库"PythonMagick“。
在Windows10上,我使用了这个链接:https://www.lfd.uci.edu/~gohlke/pythonlibs/#pythonmagick
它工作得很好。例如(使用PyCharm和Windows10),该代码将pdf的每一页转换为图像(jpg):
import PythonMagick
import subprocess
subprocess.check_call(["magick","Platforma_IoT.pdf","Platforma_IoT.jpg"], shell=True)但是当我在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.看起来我的bash没有那个库。我如何让这些代码在Ubuntu上运行呢?
发布于 2020-01-16 01:58:51
试一试
import subprocess
subprocess.check_call(["convert","Platforma_IoT.pdf","Platforma_IoT.jpg"])如果您安装了imagemagick。
否则
sudo apt-get update
sudo apt-get install imagemagick --fix-missinghttps://stackoverflow.com/questions/59755940
复制相似问题