Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
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.

Réponses (1)

Yuanjie Su
Yuanjie Su le 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)

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by