4
我的C#代码:的IronPython无法导入模块 “OS”
//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“”。错误在哪里?
但Python脚本将被安装在正确的蟒蛇路径?不在铁蟒安装路径中 – pyd