The reason why python --version is not working in the Spyder console window is because python is not recognized as a command or executable on the system's PATH. The !{sys.executable} --version command is working because it directly calls the Python executable that is associated with the currently running Python environment.
sys.executable is a Python variable that returns the absolute path of the current Python interpreter that is being used to run the script. Using !{sys.executable} ensures that the correct Python interpreter is being used to execute the command, even if there are multiple versions of Python installed on the system.
If you want to call a Python script, you can either use the !{sys.executable} script_name.py command or specify the absolute path of the Python interpreter followed by the path to the script, like C:\Python38\python.exe script_name.py.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.