首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python --有没有办法不用安装就引用幽灵脚本的DLL?

Python --有没有办法不用安装就引用幽灵脚本的DLL?
EN

Stack Overflow用户
提问于 2022-08-10 05:41:05
回答 1查看 36关注 0票数 0

我为Magick.NET找到了这个链接

Is there way to refer ghostscript's DLLs without installing?

它提到了函数: MagickNET.SetGhostscriptDirectory

Python有等效的吗?

我尝试设置路径,但在python程序中,当复制到其他机器时,它无法加载gsdll64.dll:

我的代码:

代码语言:javascript
复制
import os, time
import sys
import camelot.io as camelot
import traceback 

sys.path.insert(0, r'C:\gs\gs9.56.1\bin')
sys.path.insert(0, r'C:\gs\gs9.56.1\lib')

print('path',sys.path)

#check ghostscript lib - as done in ghostscript_backend.py
import ctypes
from ctypes.util import find_library
mylib = find_library("".join(("gsdll", str(ctypes.sizeof(ctypes.c_voidp) * 8), ".dll")))
    
print(mylib,os.getcwd())
if mylib is None:
    print('gsdll not loaded')
EN

回答 1

Stack Overflow用户

发布于 2022-08-11 11:54:42

在站点-包\ghostscript\_gsprint.py

编写代码是为了从windows注册表获取dll路径。

在函数__win32_finddll中,我添加了从我的文件夹中检查和加载dll的代码:

代码语言:javascript
复制
    LooseVrsn = "9.56.1" #from dll->Properties->details->ProductVersion
    dll_path = os.path.join(os.getcwd(),'gsdll64.dll')
    dlls.append((LooseVrsn, dll_path))
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73301138

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档