How to Determine where to install hidapi.dll?

喜夏-厌秋 提交于 2021-02-19 07:52:10

问题


Context: A Windows 10 attempt to install and test python hid per instructions:

 pip install hid

The test to import the module failed:

Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import hid
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\student\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hid\__init__.py", line 30, in <module>
    raise ImportError(error)
ImportError: Unable to load any of the following libraries:libhidapi-hidraw.so libhidapi-hidraw.so.0 libhidapi-libusb.so libhidapi-libusb.so.0 libhidapi-iohidmanager.so libhidapi-iohidmanager.so.0 libhidapi.dylib hidapi.dll libhidapi-0.dll

Released hidapi-win.zip includes pre-compiled:

   hidapi.dll
   hidapi.lib

Question: What is the thought process & facts necessary to determine the proper location to install the two files? Assume a recent new install of Windows 10 and Python 3.8


回答1:


First, you need to Unblock them. Right-clik > Properties > Unblock Place both files in the same folder where python.exe is. The location of python exe can be found in the command line as where python




回答2:


Paste the .dll and .lib file inside the Windows/System32 folder. After that restart the terminal and the hid module should find the library without a problem



来源:https://stackoverflow.com/questions/62620247/how-to-determine-where-to-install-hidapi-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!