Closed RonaldErnst closed 1 year ago
you can use addImportPath function to do that.
I'm sorry if this is too much to ask for but since there is no documentation for that function could you provide me with an example?
I'm currently on Windows and neither
py.addImportPath("path/to/.venv/Scripts/python.exe");
nor
py.addImportPath("path/to/.venv/Scripts");
seem to work for me.
Am I doing something wrong? Could you provide me with some documentation for the usage?
I would really prefer using your library over child_process
This may work: py.addImportPath("path/to/.venv/Lib/site-packages")
Python uses the sys.path variable for seach paths of the models. addImportPath will add the directory you specify to the begining of sys.path. So you have to use the directory where your models are located (in case of venv that is Lib/site-packages).
Thank you that worked!
I saw that the python interpreter that is used to run scripts is loaded from the PATH variable. Because of that our virtual environment is not being used and therefore no imports work.
Is it possible to somehow add the interpreter path that should be used?