Atom中PlatformIO-IDE-Terminal无法运行Python的问题求助
Hey there, let's get this sorted out quickly! The error you're seeing is super common on Windows systems, and it boils down to a simple difference in how Python is called between operating systems.
Why this happens
On Linux and macOS, the command to run Python 3 is typically python3, but Windows uses just python by default for Python 3 installations. That's why your terminal can't find the python3 command—it doesn't exist in your Windows environment unless you explicitly set it up.
Quick Fixes to Run Your Script
Use the Windows-compatible command
Instead of typingpython3 myfile.py, run this command in your platformio-ide-terminal:python myfile.pyThis should execute your script right away if Python is properly installed and added to your system PATH.
Set up a
python3alias (optional)
If you prefer usingpython3out of habit, you can create an alias for it:- Temporary alias (PowerShell):
Run this command in your terminal to set a one-time alias that lasts until you close the terminal:New-Alias -Name python3 -Value python - Permanent alias (PowerShell):
To make the alias stick across sessions, edit your PowerShell profile:- Run
notepad $PROFILEin PowerShell to open the profile file. - Add the line
New-Alias -Name python3 -Value pythonto the file. - Save and close the file, then restart your Atom terminal.
- Run
- Using a symbolic link:
You can also create apython3.exeshortcut pointing to your existingpython.exe:- Find your Python installation folder (e.g.,
C:\Users\Angus\AppData\Local\Programs\Python\Python312). - Open Command Prompt as Administrator, then run:
mklink "C:\Users\Angus\AppData\Local\Programs\Python\Python312\python3.exe" "C:\Users\Angus\AppData\Local\Programs\Python\Python312\python.exe" - Make sure this folder is in your system PATH, and restart Atom.
- Find your Python installation folder (e.g.,
- Temporary alias (PowerShell):
Verify Python is in your system PATH
If evenpython myfile.pydoesn't work, chances are Python isn't added to your system's environment variables:- Open System Properties → go to the Advanced tab → click Environment Variables.
- In the System variables section, find the
Pathvariable and click Edit. - Add your Python installation folder (e.g.,
C:\Users\Angus\AppData\Local\Programs\Python\Python312) and itsScriptssubfolder to the list. - Click OK to save changes, then close and reopen your Atom terminal.
Test it out
To confirm everything works, run python --version (or python3 --version if you set up the alias) in your terminal. You should see your installed Python version number printed out—this means you're good to go!
内容的提问来源于stack exchange,提问作者Angus Campbell

