我的C#代码:
//Create the ScriptRuntime
engine = Python.CreateEngine();
//Create the scope for the ScriptEngine
scope = engine.CreateScope();
string pyfile = "D:\\MyAddin\\test.py";
ScriptSource source = engine.CreateScriptSourceFromFile(pyfile);
var rt = source.Execute(scope);
还有我的test.py文件:
import os
import sys
...
print("test")
...
我在构建时没有问题,但在运行时VS给我一个错误“无法导入模块" os"”。出错的原因是什么?