VSCode出现Python未安装与cmd.exe路径不存在错误求助
Fixing VS Code Python & Terminal Errors After Environment Variable Changes
Hey there, let's break down your problem and fix it step by step—your core issue is that your Path environment variable has incorrect entries (you added full .exe file paths instead of just directories), which is confusing both VS Code and your system. Let's get this sorted:
1. Fix Your Environment Variables (Most Critical Step)
First, we need to clean up the Path variables to only include directories (not individual .exe files):
- Open System Properties → Advanced → Environment Variables (press Win+Pause/Break, then click "Advanced system settings")
- User Variables → Path:
- Remove all entries that end with
.exe, like:C:/Users/name/AppData/Local/Programs/Python/Python38-32/python.exeC:/Users/name/AppData/Local/Programs/Microsoft VS Code/Code.exeC:/Windows/System32/cmd.exe
- Keep these valid directories:
C:\Users\name\AppData\Local\Programs\Python\Python38-32C:\Users\name\AppData\Local\Programs\Microsoft VS Code\bin
- Remove all entries that end with
- System Variables → Path:
- Remove the
.exeentries here too:C:/Users/name/AppData/Local/Programs/Microsoft VS Code/Code.exeC:/Windows/System32/cmd.exe
- Make sure this critical system directory is present (it should be by default, but double-check):
C:\Windows\System32
- You can keep
C:\Users\name\AppData\Local\Programs\Microsoft VS Code\binhere if you want, but it's redundant if it's already in your userPath.
- Remove the
- Important: After making changes, restart your computer—environment variables don't take effect until you reboot.
2. Reconfigure VS Code's Python Interpreter
Once your system restarts:
- Open VS Code, press
Ctrl+Shift+Pto open the command palette - Search for and select
Python: Select Interpreter - Either choose your Python 3.8-32 installation from the list, or select
Enter interpreter pathand manually input:C:\Users\name\AppData\Local\Programs\Python\Python38-32\python.exe
3. Fix VS Code's Terminal Shell Path
- Open VS Code settings with
Ctrl+, - Search for
terminal.integrated.shell.windows - Set the value to the directory + exe (this is okay here, unlike the Path variable):
C:\Windows\System32\cmd.exe - Alternatively, you can switch to PowerShell if you prefer:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Example of a Correct Path Configuration
For reference, here's what a clean Path setup might look like for your setup:
User Environment Variable Path:
C:\Users\name\AppData\Local\Programs\Python\Python38-32 C:\Users\name\AppData\Local\Programs\Microsoft VS Code\bin C:\Users\name\AppData\Local\Microsoft\WindowsApps
System Environment Variable Path (Key Entries):
C:\Windows\System32 C:\Windows C:\Windows\System32\Wbem C:\Windows\System32\WindowsPowerShell\v1.0\
Quick Validation Checks
- Open a new Command Prompt (Win+R → type
cmd→ Enter) and runpython --version—it should show your Python 3.8 version if the Path is fixed. - Confirm
cmd.exeopens normally via Win+R →cmd—if it does, your system Path has the correctSystem32entry.
内容的提问来源于stack exchange,提问作者Dasha
相关产品推荐
相关产品推荐

