PyUSB ValueError: No backend available

后端 未结 3 1813
别跟我提以往
别跟我提以往 2020-12-11 08:02

I am runing Python 2.7.8 at Win 7 operation system. I am trying to communicate a USB device (Numato 32 channel GPIO device) by PyUSB.

I downloaded walac-pyusb-7071a

相关标签:
3条回答
  • 2020-12-11 08:42

    I did: - Download and install libusb-win32-devel-filter-1.2.6.0.exe. It should work.

    From:

    Pyusb on windows - no backend available

    And really works for me.

    0 讨论(0)
  • 2020-12-11 08:53

    I had this trouble, and i switched python libusb wrappers and its gone: https://github.com/vpelletier/python-libusb1

    0 讨论(0)
  • 2020-12-11 08:58

    I had the same error, but I didn't succeed to use find_library(TypeError: get_backend() got an unexpected keyword argument 'find_library'). I suppose, although you did not say it, that backend is not valid (None).

    Do you have the libusb1 implementation in the path C:\Python27 ? I suppose you didn't install it in the Python's folder and if so, there's your answer: PyUSB backend not accessible.

    Otherwise, without using find_library, you must have the libusb1 implementation available in the PATH environment variable. I did it like this (you can replace os.getcwd() with your location):

    def get_backend_libusb01():
        libusb01_location = os.getcwd()
    
        # load-library (ctypes.util.find_library) workaround: also search the current folder
        is_current_folder_in_search_path = True
        if None == usb.backend.libusb0.get_backend():
            is_current_folder_in_search_path = libusb01_location in os.environ['PATH']
            if not is_current_folder_in_search_path:
                os.environ['PATH'] += os.pathsep + libusb01_location
    
        backend = usb.backend.libusb0.get_backend()
    
        if not is_current_folder_in_search_path:
            os.environ['PATH'] = os.environ['PATH'].replace(os.pathsep + libusb01_location, "")
    
        return backend
    
    0 讨论(0)
提交回复
热议问题