问题
I'm new at Python, and I'm trying to write my first Python application on Visual Studio CE 2015 using IronPython.
I finally managed to execute the most basic .NET-compatible code importing the clr
module (which comes with the whole IronPython package) but, since my goal is writing an application that reads from a USB scale following this blog post, I'm stuck at trying to import the usb
module.
I downloaded and installed both pyUSB and libusb, so I thought I had to simply add the reference in the "reference" section like any other normal .NET applications, but I can't find nor the reference nor the DLL file path. What's the missing link??
import clr
clr.AddReferenceToFileAndPath(r"What\Is\The\Path\Going\Here?")
import usb.core
回答1:
Thanks to @Xaerxess, I finally understand python libraries are just .py files that are to be found in the compiler directory. I copied the usb directory under the compiler's lib directory and it worked.
来源:https://stackoverflow.com/questions/44563098/reference-a-library-in-ironpython-using-visual-studio