Effacer les filtres
Effacer les filtres

Media Pipe Python Interfacing with MATLAB

61 vues (au cours des 30 derniers jours)
Morrison
Morrison le 29 Mai 2024
Commenté : Morrison le 4 Juin 2024
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.

Réponse acceptée

Milan Bansal
Milan Bansal le 3 Juin 2024
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 commentaire
Morrison
Morrison le 4 Juin 2024
Thank you! It seemed to have been an issue with the system PATH.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Call MATLAB from Python dans Help Center et File Exchange

Produits


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by