Skip to content

Commit 3432a2b

Browse files
committed
Install: Ensure pyenv path is correct
1 parent f257c10 commit 3432a2b

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

mhkit/package/+mhkit/install.m

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,20 @@ function initialize_python_integration(env_name, logger)
197197
python_path = strip(python_path);
198198
logger.info('Found Python executable: %s', python_path);
199199

200-
% Set MATLAB's Python environment to use this executable
201-
pyenv('Version', python_path);
200+
% Add Python directory to system PATH (like the working Unix tests)
201+
python_dir = fileparts(python_path);
202+
current_path = getenv('PATH');
203+
if isunix
204+
new_path = [python_dir ':' current_path];
205+
else
206+
new_path = [python_dir ';' current_path];
207+
end
208+
setenv('PATH', new_path);
209+
logger.info('Added Python directory to PATH: %s', python_dir);
210+
211+
% Set MATLAB's Python environment with OutOfProcess execution mode (like working Unix tests)
212+
pyenv('Version', python_path, 'ExecutionMode', 'OutOfProcess');
213+
logger.info('Configured pyenv with OutOfProcess execution mode');
202214

203215
% Test Python import
204216
logger.info('Testing Python module imports...');

0 commit comments

Comments
 (0)