フィルターのクリア

Matlab "pyenv" doesn't respect user path / user env configured with anaconda

8 ビュー (過去 30 日間)
Tucker Downs
Tucker Downs 2021 年 12 月 19 日
回答済み: Suman 2024 年 2 月 15 日
Hello all!
I am trying to run a python script from matlab and get the results, my script requires python 3 and several packages that I have installed and cofigured using anaconda workspaces. When I run !which python it only finds the MacOS default python location, which is not the correct version and does not have the correct packages. pyenv reveals that matlab is only finding the OSx default python and libraries.
In my terminal I have used anaconda to maintain several python environments required for different projects and I have correctly configured my default environment before launching matlab. How can I get matlab to respect my python environment management, like every other piece of software that I regularly use does?

回答 (1 件)

Suman
Suman 2024 年 2 月 15 日
Hi Tucker,
As per my understanding, you have created a python environment in anaconda with python3 and several packages and you would like MATLAB to use that python installation instead of the default OS python installation.
You can specify which python interpreter that MATLAB is going to use using the following command at the MATLAB command line:
pyenv('Version', '<path_to_your_anaconda_python_executable>');
#for example, pyenv('Version', '/usr/bin/python')
I hope that helps!

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by