我一直在尝试使用Python 2.7和python-escpos打印带有Epson TM-t20ii的简单收据。安装了打印机驱动程序,还将libusb 1.2.6 .sys和.dll文件复制到各自的文件夹中。
下面是程序的样子:
from escpos import *
Generic = printer.Usb(0x04B8,0x0E15)
Generic.text("Test Print!\n")
Generic.cut()
这是追溯:
Traceback (most recent call last):
File "D:/Proyectos/QT/PymePOS/pymepos/pyscrpts/print.py", line 7, in <module>
Generic = printer.Usb(0x04B8,0x0E15)
File "C:\Python27\lib\site-packages\escpos\printer.py", line 34, in __init__
self.open()
File "C:\Python27\lib\site-packages\escpos\printer.py", line 52, in open
self.device.detach_kernel_driver(0)
File "C:\Python27\lib\site-packages\usb\core.py", line 1005, in detach_kernel_driver
interface)
File "C:\Python27\lib\site-packages\usb\backend\libusb0.py", line 541, in detach_kernel_driver
_check(_lib.usb_detach_kernel_driver_np(dev_handle, intf))
File "C:\Python27\lib\ctypes\__init__.py", line 378, in __getattr__
func = self.__getitem__(name)
File "C:\Python27\lib\ctypes\__init__.py", line 383, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'usb_detach_kernel_driver_np' not found
我正在使用Win10 64位和打印出来的usb 任何workarrounds或解决方案!? 谢谢!