필터 지우기
필터 지우기

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

조회 수: 2 (최근 30일)
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.

답변 (1개)

Yuanjie Su
Yuanjie Su 2019년 9월 20일
[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)

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by