Reference a library in IronPython using Visual Studio

限于喜欢 提交于 2019-12-24 06:32:42

问题


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

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