python environment mysteriously loads by itself?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
The title of this post summarizes the issue. I am slighty confused why Python loads without my explicit permission.
I am working on a MATLAB project where startup file contains a line that loads Python using pyenv.
If I wait a few minutes between opening MATLAB and starting the project, I get the "Python is loaded" error message, even though I haven't yet loaded it:
Warning: Error using pyenv
Python is loaded. The environment cannot be changed in this MATLAB session. To change the environment, restart MATLAB, and then call 'pyenv'.
I understand my question might be a bit vague and I would be glad to provide more details as needed... I'm not quite sure where to go from here
5 Kommentare
Antworten (1)
Siraj
am 25 Sep. 2023
Hi!
It seems that you have a query regarding why Python is loading without your explicit permission. You mentioned working on a project that involves an "initPython3.m" startup file. This file, which is a .m script, runs automatically when you open a saved project. However, even if you are not actively starting the project, you are still encountering the "Python is loaded" error.
The reason for this behaviour is that starting from R2014b and subsequent releases, MATLAB has a default preference where the last working directory from the previous session is set as the Startup Folder. This means that when you double-click the MATLAB icon on your Windows desktop or in the Start menu, it will open in the last working directory.
If you had a project open when you closed MATLAB, the next time you open MATLAB, it will automatically open that project and execute the "initPython3.m" startup file, even if you didn't explicitly open the project. You can find more information about the "MATLAB Startup Folder" in the following link.
To understand the possible causes of the "Python is loaded" error and explore potential workarounds, you can refer to the following link.
Hope this helps.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!