unable to get matlab to recognize the python installed on my computer

I am working with Matlab R2021a in Windows. There is an installed python version on the computer.
It was installed using Anaconda, when i open an anaconda promt and use 'python -V' the answer i get is 'Python 3.8.8'.
When i use the command 'pyenv' in my matlab command window i get an empty PythonEnvironment structure.
I also tried downloading python version 3.8.0 from https://www.python.org/downloads/release/python-380/, following the instructions in the Matlab Help documentation, but still - using 'pyenv' results in an empty PythonEnvironment structure.
What am i doing wrong?
Thanks!

 채택된 답변

Yongjian Feng
Yongjian Feng 2022년 1월 19일

1 개 추천

python on Windows might be tricky. Did you follow this page? Maybe you need to setup your PATH environment variable first?

댓글 수: 4

Yes, I followed the instructions, and also added the path to the 'python.exe' to the MATLAB path.
Still, it gives an empty result.
Try this one please from matlab command line:
system('python -c "print(3.1415926)"')
ok, after adding it ALSO to the path of the "system enviroument variables" it works.
Yes, this is the path I meant. Matlab needs this to look for the python executable. Please accept the answer if it works.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

제품

릴리스

R2021a

질문:

2022년 1월 19일

댓글:

2022년 1월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by