Filter löschen
Filter löschen

How to run a matlab exe which contains python commands from another python code?

2 Ansichten (letzte 30 Tage)
I have a Matlab code which calls some python modules. I made an exe from this Matlab code (let's call it pipeMe.exe) now I'm trying to run pipeMe.exe from another python code in another machine of course but apparently, it can't set the python version executable path from the second machine, thus it gives me this error:
Undefined variable "py" or class "py.sys.path".
Is there any way that I can set the pyversion executable from outside of Matlab while I run pipeMe.exe ? Or is there any possibility to set the pyversion executable path to a path that is accessible from both machines, and I just have to set it at the beginning of my pipeMe matlab code?
Thanks in advance for your help.

Antworten (1)

Yuanjie Su
Yuanjie Su am 20 Sep. 2019
[name,dir,index]=uigetfile({'*.exe'},'choose python.exe file');
if index==1
py_path=[dir name];
pyversion(py_path);
end
py_path is your python interpreter file path.(the file is called python.exe)

Kategorien

Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by