Matlab function "pyenv"
조회 수: 18 (최근 30일)
이전 댓글 표시
I need to convert one function from Matlab to Python. My Matlab version is R2022.b. Compatible Python version is 3.10. Both Matlab and Python are now installed on my PC. When I run the function "pyenv" in Matlab, I receive empty fields and message "Python commands require a supported version of CPython."
Regarding Matlab, I have: Matlab, Financial Toolbox, Optimization Toolbox, and Statistics and Machine Learning Toolbox.
Do I need to get some other toolboxes for Matlab to be able to see/work with Python?
Thank you.
Stefan
댓글 수: 3
Chris
2023년 3월 13일
편집: Chris
2023년 3월 13일
@Stefan Martinek is the appropriate environment variable for python set? to find out, you can execute these two commands in Matlab:
p = string(strsplit(getenv('PATH'),';')');
p(contains(p,'python'))
It should be something like "C:\Users\[username]\AppData\Local\Programs\Python\Python310\python"
If it's not there, the easiest way to add it would be to re-run the python installer, select "Modify," and "Add Python to enviromnent variables." Then restart Matlab after the installation is complete.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1323045/image.png)
답변 (1개)
Mathy
2024년 5월 20일
Hi,
Once you have installed Python on your system, make sure that your Python environment variable is configured to be at the top of the system's PATH environment variable list.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1699031/image.jpeg)
After doing this,please restart MATLAB and try again.
I hope this helps!
Amith
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!