在 Python 上导入 ghostscript 时出现类型错误
TypeError when importing ghostscript on Python
我已经在我的机器上安装了 ghostscript,位于
C:\Program Files (x86)\gs\gs9.20
并通过 pip
安装了 python 模块
pip install ghostscript
然而,当我尝试导入 ghostscript 时,出现了这个错误
>>> import ghostscript
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import ghostscript
File "C:\Python27\lib\site-packages\ghostscript\__init__.py", line 33, in <module>
import _gsprint as gs
File "C:\Python27\lib\site-packages\ghostscript\_gsprint.py", line 281, in <module>
libgs = windll.LoadLibrary(libgs)
File "C:\Python27\lib\ctypes\__init__.py", line 440, in LoadLibrary
return self._dlltype(name)
File "C:\Python27\lib\ctypes\__init__.py", line 362, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be string, not Unicode
Ghost 脚本在 python v2.7.13 中不工作,所以 运行 安装 v2.7.12 并通过 v2.7.12 导入没有错误
我已经在我的机器上安装了 ghostscript,位于
C:\Program Files (x86)\gs\gs9.20
并通过 pip
安装了 python 模块pip install ghostscript
然而,当我尝试导入 ghostscript 时,出现了这个错误
>>> import ghostscript
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import ghostscript
File "C:\Python27\lib\site-packages\ghostscript\__init__.py", line 33, in <module>
import _gsprint as gs
File "C:\Python27\lib\site-packages\ghostscript\_gsprint.py", line 281, in <module>
libgs = windll.LoadLibrary(libgs)
File "C:\Python27\lib\ctypes\__init__.py", line 440, in LoadLibrary
return self._dlltype(name)
File "C:\Python27\lib\ctypes\__init__.py", line 362, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be string, not Unicode
Ghost 脚本在 python v2.7.13 中不工作,所以 运行 安装 v2.7.12 并通过 v2.7.12 导入没有错误