Media Pipe Python Interfacing with MATLAB

34 ビュー (過去 30 日間)
Morrison
Morrison 2024 年 5 月 29 日
コメント済み: Morrison 2024 年 6 月 4 日
Hi, so I've done some research and I've found that MATLAB can interface with Python in a pretty straightforward manner, but I'm running into an issue. For some reason, when I download Python from a browser (executable installation), MATLAB can detect it but when I try to run the setup commands for the Media Pipe program through the command prompt it says: "The system cannot find the file specified," it seems to be looking for Python 3.12 for some reason even though the only version I have installed is 3.11. Inversely, I have the opposite problem when I install the Python 3.11 from the Microsoft store, I can install the Media Pipe program but then MATLAB can't recognize it. When MATLAB can't find the version of Python, it pops up with an error message, stating: "Unable to create process using... The system cannot find the file specified." I'm stuck on where to go from here since I'm new to using Python, but have been using MATLAB for quite some time. Any advice on what to try in order to troubleshoot would be appreciated.

採用された回答

Milan Bansal
Milan Bansal 2024 年 6 月 3 日
Hi Morrison,
It sounds like you're encountering issues with Python path configuration and version mismatches between MATLAB and Python installations. Here are some steps to troubleshoot and resolve these issues:
  • Verify Python Installation Paths: Ensure you have installed Python correctly. When you install Python, especially from the executable installer, ensure that you check the option to add Python to your system PATH. This is crucial for both MATLAB and the command prompt to recognize the Python installation. You may also add the PATH to your system variables manually.
  • Check the Python version: Ensure that the correct version of Python is installed, which is compatible with your MATLAB version. Confirm the Python version installed by running python --version in the command prompt. Here is a list of Python versions compatible with different MATLAB releases: https://www.mathworks.com/support/requirements/python-compatibility.html .
  • Install MediaPipe: Ensure that MediaPipe is installed in the correct Python environment. You can install packages using pip: pip install mediapipe.
Setup the Python environment in MATLAB and check for the MediaPipe version in MATLAB. Here is how this can be done:
  • Set the Python environment in MATLAB using pyenv.
pyenv('Version', 'yourPath\Python311\pythonw.exe');
pe = pyenv;
disp(pe);
  • Run Python commands in MATLAB using pyrun to import mediapipe and display its version.
pyrun("import mediapipe as mp")
pyrun("print(mp.__version__)")
Please refer to the following documentation links to learn more about pyenv, pyrun and calling Python from MATLAB.
Hope this helps!
  1 件のコメント
Morrison
Morrison 2024 年 6 月 4 日
Thank you! It seemed to have been an issue with the system PATH.

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品


リリース

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by