You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

无法为Python安装pipx或Brownie的技术求助

Fixing "Python3 is not recognized" Error in VS Code on Windows

Hey there, let's work through this issue step by step—this is a super common gotcha for Windows users, so don't stress too much! Here's what you can try:

1. Use Windows' Default Python Commands First

On Windows, Python installations (including those from the Microsoft Store) almost always use python instead of python3 by default. Try running these commands in your VS Code terminal first to confirm Python is accessible:

python --version
py --version

The py command is the official Python launcher for Windows, which should detect all installed versions automatically. If either of these works, that means Python is installed correctly—you just need to stop using python3 for commands.

2. Verify VS Code's Python Interpreter Selection

VS Code might be pointing to a non-existent interpreter. Let's fix that:

  • Press Ctrl+Shift+P to open the command palette
  • Search for Python: Select Interpreter
  • Choose the Python version you installed (look for the path that matches your Microsoft Store or manual install location)
  • Restart your VS Code terminal after selecting—this ensures it uses the correct interpreter.

3. Double-Check Your Environment Variables (And Restart!)

You mentioned modifying environment variables, but sometimes changes don't take effect until you restart your terminal/VS Code. Here's what to confirm:

  • Open System Properties > Advanced > Environment Variables
  • Under User Variables or System Variables, check that your Python installation folder (e.g., C:\Users\YourName\AppData\Local\Programs\Python\Python311) and its Scripts subfolder are added to the Path variable
  • Critical: Close all open terminals and VS Code completely, then reopen them. Environment variable changes don't apply to already running programs.

4. Set a python3 Alias (If You Really Need It)

If you want to keep using python3 like you would on macOS/Linux, you can set a permanent alias in PowerShell:

  • Open PowerShell and run notepad $PROFILE (this opens your PowerShell profile file)
  • Add this line to the file:
    New-Alias python3 python
    
  • Save the file and restart PowerShell/VS Code. Now python3 will map to your default python command.

5. Install pipx Correctly Using Python's Module Syntax

Instead of relying on pipx directly, install it using Python's built-in module system to avoid path issues:

python -m pip install --user pipx
python -m pipx ensurepath

The ensurepath command adds pipx's executable folder to your environment variables automatically. Again, restart your terminal after running this.

If none of these steps work, try uninstalling Python completely (remove all versions from Settings > Apps), delete any remaining Python folders in AppData\Local\Programs\Python, then reinstall from the official Python website (not the Microsoft Store—sometimes the Store version has weird path quirks).


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

火山引擎 最新活动