c# - IronPython: Unexpected token 'from' -
i running python script .net using ironpython, below python script
import tensorflow tf print('tensorflow imported')
below c# code
using system; using system.text; using system.io; using ironpython.hosting; using system.collections.generic; using microsoft.scripting.hosting; namespace consoleapplication1 { class program { private static void main() { var py = python.createengine(); list<string> searchpaths = new list<string>(); searchpaths.add(@"c:\users\admin\appdata\local\programs\python\python35\lib)"); searchpaths.add(@"c:\users\admin\appdata\local\programs\python\python35\lib\site-packages)"); py.setsearchpaths(searchpaths); try { py.executefile("script.py"); } catch (exception ex) { console.writeline(ex.message); } } } }
below output
unexpected token 'from'
if remove import statement python script executes fine. tried including os,sys
imported without issue. have installed tensorflow via pip, when run above script through python console(v3.5) works fine.
update: in tf doc written "tensorflow supports version 3.5.x of python on windows". official release of ironpython version 2.7 happy find ironpython on github, tried building (i typed build in console , got freaked out long list of error messages showed! :d couldn't find pre-compiled binaries
is there alternative way import tensorflow in ironpython 2.7 or run python in .net?
Comments
Post a Comment