4

Working on pyinstaller 3.1, python 2.7.9, and tkinter.

Try to use pyusb instead of pyserial, but no backend available. Looking into Pyusb on windows - no backend available, PyUSB ValueError: No backend available, USB interface in Python, and so on, it seems that I need to install libusb. But when I run "import usb" and "import usb.core" under python, no errors. I have no idea how to install it and how to use it in my project, how to tell my project where libusb is.

what I did:

(1) download libusb-win32-bin v1.2.6.0 (01/17/2012)

(2) x86\libusb0_x86.dll renamed to libusb0.dll

(3) On 64 bit, put it to Windows\syswow64\libusb0.dll. On 32 bit, Installs to Windows\system32\libusb0.dll.

Still not working...

By the way, I would like to finish one standalone python-based windows app. I do not hope others to install libusb to run my app. What to do?

Community
  • 1
  • 1
BAE
  • 8,550
  • 22
  • 88
  • 171

2 Answers2

15

I downloaded latest libusb windows binaries from here: http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.20/libusb-1.0.20.7z/download then I copied libusb1.dll according to this: when you are on 64-bit Windows, MS64\dll\libusb-1.0.dll must be copied into C:\Windows\System32 and (for running 32-bit applications that use libusb) MS32\dll\libusb-1.0.dll must be copied into C:\Windows\SysWOW64. and then I copied libusb1.lib from binaries to lib dir in python directory and now pyusb works for me. hope it helps.

user3365107
  • 228
  • 2
  • 13
  • 1
    small correction. libusb lib file can be found at ..\libusb-1.0.20\MS64\static\libusb-1.0.lib for x64 – user3365107 Jan 11 '16 at 12:58
  • are you using 32-bit or 64-bit python? does it matter? – endolith Jan 12 '16 at 15:27
  • I am using 64 bit. but I dont think it should matter.Of curse if you use 32 bit make sure you copy the right files. – user3365107 Jan 13 '16 at 18:07
  • It works for me with Win10 and Python2.7(32-Bit) and Python3.5(32-Bit) and Python3.5(64-Bit) – rundekugel Jul 05 '16 at 12:37
  • 1
    on the last part to make it precise: for x64 copy ..\libusb-1.0.20\MS64\static\libusb-1.0.lib to C:\Users\\AppData\Local\Programs\Python\Python36-32\libs if you installed Python in default dir – Siemkowski May 22 '18 at 21:18
0

No need to copy and paste the libusb-1.0.lib file to your C drive, just do the things with libusb-1.0.dll file. It works for me.