Using python files with libraries in Visual Studio

杀马特。学长 韩版系。学妹 提交于 2020-01-03 00:53:08

问题


I want to use some python files in a Visual Studio WPF application, using this code.

var ipy = Python.CreateRuntime();
dynamic test = ipy.UseFile("Test.py");
string whatever = test.pythonString()
MessageBox.Show(whatever);

where Test.py looks like this:

def pythonString:
   return "Whatever"

everything works as expected but if I add any import like

from moviepy.editor import *

to the python code the messagebox doesn't appear. Why does this happen and what do I have to change in order to make python work in Visual studio with libraries?

EXTRA INFO: I use Visual Studio 2015 on Windows 7.

I set up IronPython like this: https://blogs.msdn.microsoft.com/charlie/2009/10/25/running-ironpython-scripts-from-a-c-4-0-program/

来源:https://stackoverflow.com/questions/39862954/using-python-files-with-libraries-in-visual-studio

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