Problem with Python version on Matlab R2018a

5 visualizaciones (últimos 30 días)
Alessandro Mignocchi
Alessandro Mignocchi el 17 de Jul. de 2023
Comentada: Alessandro Mignocchi el 20 de Jul. de 2023
I have a MacBook Air, with Matlab 2018a installed.
I'm trying to change the default Python 2.7 version with Python 3.6, but in Matlab 2018a the function pyenv() is not aveilable. How can I change the Python version?

Respuestas (1)

Anavi Somani
Anavi Somani el 18 de Jul. de 2023
Hi Alessandro, in MATLAB 2018a, the `pyenv()` function is not available to change the default Python version. However, you can still change the Python version used by MATLAB by following these steps:
1. Determine the location of the Python executable for the desired version (Python 3.6) on your system. Typically, it is located in `/usr/bin/python3` or `/usr/local/bin/python3`.
2. Open MATLAB and go to the "Home" tab.
3. Click on "Preferences" to open the MATLAB Preferences dialog box.
4. In the Preferences dialog box, select "Python" under "MATLAB" on the left-hand side.
5. In the "Python" section, click on the "Manage Configurations" button.
6. In the "Manage Configurations" dialog box, click on the "Add" button.
7. In the "Add Configuration" dialog box, provide a name for the new Python configuration (e.g., Python 3.6).
8. In the "Python Executable" field, enter the path to the Python executable for Python 3.6
(e.g., `/usr/bin/python3` or `/usr/local/bin/python3`).
9. Click "OK" to save the new Python configuration.
10. In the "Manage Configurations" dialog box, select the newly created Python configuration (Python 3.6) and click on the "Set as Default" button.
11. Close the Preferences dialog box.
Now, MATLAB will use the specified Python version (Python 3.6) as the default Python interpreter.
Please note that changing the default Python version in MATLAB may have implications for any existing scripts or functions that rely on the previous Python version. Make sure to test your code thoroughly after making this change.
  1 comentario
Alessandro Mignocchi
Alessandro Mignocchi el 20 de Jul. de 2023
In the Preference dialog box I have's not any 'Python' choice.

Iniciar sesión para comentar.

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by