Error 'Python est introuvable'

31 Ansichten (letzte 30 Tage)
Nathalie Brun
Nathalie Brun am 28 Jun. 2021
Beantwortet: Tejas am 23 Feb. 2024
Hi
I am on Windows 10
I configured the environment such as :
Status: Loaded
ExecutionMode: InProcess
ProcessID: "8804"
ProcessName: "MATLAB"
When I try to run the Python code with :
system('python python/vae_keras_ems_train.py')
I get the message :
Python est introuvable. ExÚcutez sans argument pour procÚder Ó l
ans =
9009
Thanks !

Antworten (1)

Tejas
Tejas am 23 Feb. 2024
Hello Nathalie,
It seems you are encountering the "Python not found" issue. To resolve this, please follow the steps outlined below.
Firstly, ensure that the version of Python you are using is compatible with your MATLAB version. You can refer to the following documentation for guidance: https://www.mathworks.com/support/requirements/python-compatibility.html?s_tid=srchtitle_site_search_1_python%20compatibility#:~:text=3.7%2C%203.8%2C%203.9-,R2021a,-2.7%2C%203.7%2C%203.8 .
Next, verify that Python is added to the "Environment Path" variables. If it is not, you can add it by going to the Start Menu, typing "Edit environment variables for your account," and then selecting "Path" under User variables. Click "Edit" and enter the path to your Python executable.
Now, in the MATLAB command window, type the following command:
>> pyenvpyenv( 'Version', 'path_to_python_executable', 'ExecutionMode', 'OutOfProcess');
This command will link Python to MATLAB. To verify whether the linking is successful, type the following command in the MATLAB command window:
>> pyenv
This will display the Python version and the path to the Python executable file.
Ensure that you add the Python file you wish to run to the MATLAB path. This will enable you to successfully execute the Python file using the "system" function call.
To learn more about pyenv function, follow the guidelines in this documentation:
Hope it helps!

Kategorien

Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by