Tool for cross-platform interacting C# and Python system interpreters
This library is made on .net standard 2.0, respectively, there is compatibility with .net framework 4.6.2+ and .net core 2.0+
- working on Windows, macOS and Linux
- lazy getting all system interpreters with their versions and paths
- running a python script using the specified interpreter
IEnumerable<PythonInterpreter> interpreters = PythonEngine.PythonInterpreters;
var actualInterpreter = PythonEngine.PythonInterpreters
.OrderByDescending(i => i.Version)
.First();
var interpreter = PythonEngine.PythonInterpreters
.First(i => string.CompareOrdinal(i.Version, "3.0.0") > 1);
var interpreter = PythonEngine.PythonInterpreters
.First(i => string.CompareOrdinal(i.Version, "3.0.0") < 0 &&
string.CompareOrdinal(i.Version, "2.0.0") > 1);
PythonInterpreter enigEngine = PythonEngine.PythonInterpreters.First();
PythonEngine engine = new PythonEngine(enigEngine);
ExecutionResult result = engine.Execute("path-to-script.py", "argValue1", "argValue2", "argValueN");
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.