You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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.exe
      • C:/Users/name/AppData/Local/Programs/Microsoft VS Code/Code.exe
      • C:/Windows/System32/cmd.exe
    • Keep these valid directories:
      • C:\Users\name\AppData\Local\Programs\Python\Python38-32
      • C:\Users\name\AppData\Local\Programs\Microsoft VS Code\bin
  • System Variables → Path:
    • Remove the .exe entries here too:
      • C:/Users/name/AppData/Local/Programs/Microsoft VS Code/Code.exe
      • C:/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\bin here if you want, but it's redundant if it's already in your user Path.
  • 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+P to 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 path and 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 run python --version—it should show your Python 3.8 version if the Path is fixed.
  • Confirm cmd.exe opens normally via Win+R → cmd—if it does, your system Path has the correct System32 entry.

内容的提问来源于stack exchange,提问作者Dasha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 14:42:46