Filter löschen
Filter löschen

Problem with Python version on Matlab R2018a

14 Ansichten (letzte 30 Tage)
Alessandro Mignocchi
Alessandro Mignocchi am 17 Jul. 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?

Antworten (1)

Anavi Somani
Anavi Somani am 18 Jul. 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.

Kategorien

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

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by