MATLAB Answers

0

pyversion: "Path argument does not specify a valid executable."

Asked by Joe Sheridan on 5 Feb 2015
Latest activity Commented on by Dmitry
on 22 Oct 2015
Hi,
I have 32-bit version of MATLAB 2014b (8.4.0.150421 (R2014b)) and a 32 bit version of python (Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32) on a windows 7 64-bit machine. I installed python using the standard installer on python.org. I have python in the system path (which MATLAB confirms when I use a "getenv('PATH')" command.) Every time I try to get pyversion to recognize python, I get "Error using pyversion: Path argument does not specify a valid executable." I have tired using just 2.7 as an argument as well as the full path to the executable 'C:\Python27\python.exe'. (And I've confirmed python really is there.) Is there something I'm missing, or haven't set up properly?
Thanks!

  5 Comments

One other thing that's really strange. I can call MATLAB from python, and when I do pyversion gives the correct value.
>>> eng = matlab.engine.start_matlab();
>>> eng.pyversion();
'2.7'
What about pyversion with nargout=0?
>>> eng.pyversion(nargout=0)
Python environment settings are stored in matlab.settings file in the prefdir (MATLAB preferences directory) of user which is MATLAB is started by. They are in section:
<settings name="external">
<settings name="interfaces">
<settings name="python">
<key name="Version">
Under my Win 8.1 environment, for example, they look like this:
<string minArraySize="4" maxArraySize="4">
<value><![CDATA[3.4]]></value>
<value><![CDATA[C:\Anaconda3\python.exe]]></value>
<value><![CDATA[C:\Anaconda3]]></value>
<value><![CDATA[C:\Anaconda3\python34.dll]]></value>
</string>
Under Ubuntu environment it looks like this:
<string minArraySize="4" maxArraySize="4">
<value><![CDATA[3.4]]></value>
<value><![CDATA[/root/anaconda3/bin/python]]></value>
<value><![CDATA[/root/anaconda3]]></value>
<value><![CDATA[/root/anaconda3/lib/libpython3.4m.so]]></value>
</string>
When I've got an error Joe Sheridan have mentioned, I just inserted applicable paths into matlab.settings directly.
Also, at least under Ubuntu it is hard to predict, which matlab.settings file MATLAB will use - I've ran into cases when MATLAB was started under one user and was using matlab.settings of another user.

Sign in to comment.

0 Answers