Matlab function "pyenv"

9 ビュー (過去 30 日間)
Stefan Martinek
Stefan Martinek 2023 年 3 月 12 日
回答済み: Amith 2024 年 5 月 20 日
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 件のコメント
Stefan Martinek
Stefan Martinek 2023 年 3 月 13 日
I installed it from python.org, version 3.10, https://www.python.org/downloads/release/python-3109/ bottom of the page "Windows Installer (64 bit)".
Chris
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.

サインインしてコメントする。

回答 (1 件)

Amith
Amith 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.
After doing this,please restart MATLAB and try again.
I hope this helps!
Amith

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by