背景。我想使用camelot.read_pdf(file)
它使用 Ghostscript。
- 该项目有
ghostscript
包。 - Windows 10 已安装 Ghostscript 9.54.0 for Windows (64 bit) 。
2.1.
c:\Program Files\gs\gs9.54.0\bin
已添加到系统PATH
环境变量中。 - Python 3.9 64 位。
所需的库路径是c:\Program Files\gs\gs9.54.0\bin\gsdll64.dll
。
但Python并没有“看到”它。因为它可能没有加载到系统中。
File "C:\Users\USERNAME\.virtualenvs\PROJECT\lib\site-packages\camelot\backends\ghostscript_backend.py", line 31, in convert
raise OSError(
OSError: Ghostscript is not installed. You can install it using the instructions here: https://camelot-py.readthedocs.io/en/master/user/install-deps.html
那么,它应该如何工作?我错过了哪一步?
最佳答案
已解决。
首先,Python可以通过环境PATH变量中的路径找到DLL。因此,路径 c:\Program Files\gs\gs9.54.0\bin
必须出现在那里。
PyCharm(或其他 IDE)必须重新加载(这是我的主要错误)。
感谢@Petesh 的评论。
关于python - 如何在Windows中将ghostscript DLL库提供给python?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69064465/