Reference a library in IronPython using Visual Stu

2019-07-25 05:45发布

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条回答
【Aperson】
2楼-- · 2019-07-25 05:53

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.

查看更多
登录 后发表回答