vpelletier / python-libusb1

Python ctype-based wrapper around libusb1
GNU Lesser General Public License v2.1
168 stars 65 forks source link

How to install libusb-1.0 dll for libusb1 on win64 #7

Closed RiceeeChang closed 9 years ago

RiceeeChang commented 9 years ago

I have some problem when I test this package on win64.

File "C:\Python27\lib\site-packages\libusb1.py", line 195, in libusb = _loadLibrary() File "C:\Python27\lib\site-packages\libusb1.py", line 166, in _loadLibrary return dll_loader('libusb-1.0' + suffix, loader_kw) File "C:\Python27\lib\ctypesinit.py", line 365, in init** self._handle = _dlopen(self._name, mode) WindowsError: [Error 126] The specified module could not be found

then I download the binary for windows from http://libusb.info/ but I have no idea which file I should use and where I could put the dll file. Could anyone help me, please

vpelletier commented 9 years ago

Hi.

First, I do not have a 64bits windows at hand, so I'm just guessing and cannot actually check. In the archive you have likely downloaded (libusb-1.0.19-rc1-win.7z), you need to extract MS64\dll\libusb-1.0.dll or MS32\dll\libusb-1.0.dll. Choosing between MS64 and MS32 directories likely depends on the python build you are using, whether it was built for 64bits or 32bits. Contained README advises to either install the DLL in system32 (no idea if that name is applicable on 64bits windows) or in the runtime directory. The latter may both mean it should be put in the same directory as your script, or in the same directory as the python interpreter. I guess you should first try to put it in the same directory as your script first, as it seems cleaner.

RiceeeChang commented 9 years ago

Thank you for your response. I have ever tried placing the dll file in the package directory in python (C://python27/lib/site-packages) and placing the dll file in c://windows/sysWow64. Both of they are useless.

I just put the dll file at the same directory with my script, then it work. Thank you again.

vpelletier commented 9 years ago

I have ever tried placing the dll file in the package directory in python (C://python27/lib/site-packages)

This would be the pace for python modules. Here it is not python but the dynamic library loader which needs to find the library - so I would have tried to put the library next to python.exe.

Then again, for distribution ease (if you intend to distribute the program you are working on) and for the sake of avoiding the risk of doing mistakes in system/other program folders, putting it next to your script is likely a better solution - so I'm glad it works there.

Closing bug as resolved, thanks.

Sebatset11 commented 7 years ago

thanks! the same error drove me crazy for half weekend :)!!

oznotes commented 5 years ago

put the "libusb-1.0.dll" in your script folder worked for me too .