Using python files with libraries in Visual Studio

2019-05-31 09:24发布

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/

0条回答
登录 后发表回答