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

运行Python文件时提示‘Python’不是内部或外部命令的问题求助

Fixing the "'Python' is not recognized" Error on Windows

Hey there! Let's work through why your Python command isn't being recognized, even after trying some fixes. Here's a step-by-step breakdown to get it sorted:

1. Locate Python 3.10's actual installation directory

The path you found in the Start Menu (C:\Users\faiqf\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.10) is just the shortcut location—not where the actual python.exe executable lives. Here's how to find the real path:

  • Right-click the Python 3.10 icon in your Start Menu and select Open file location
  • In the folder that opens, right-click the Python shortcut again and choose Properties
  • Look at the Target field—this will show you the full path to python.exe (it should look something like C:\Users\faiqf\AppData\Local\Programs\Python\Python310\python.exe). Copy the folder part (without python.exe at the end) for later.

2. Update your PATH environment variable

Right now, your PATH includes C:\Python34\Scripts (for an older Python version) but no entry for Python 3.10's main directory (where python.exe is stored). Here's how to add it:

  • Right-click This PC → Properties → Advanced system settings → Environment Variables
  • Under System variables, find the Path variable and click Edit
  • Click New and paste the Python 3.10 folder path you copied earlier (e.g., C:\Users\faiqf\AppData\Local\Programs\Python\Python310)
  • Click New again and add the Scripts folder for Python 3.10 (it's inside the main folder, e.g., C:\Users\faiqf\AppData\Local\Programs\Python\Python310\Scripts)
  • Move these new entries to the top of the Path list (so Windows prioritizes Python 3.10 over the older Python 3.4)
  • Click OK on all windows to save changes

3. Restart your command prompt and test

Environment variable changes don't take effect in already open cmd windows. Close any existing cmd windows, open a new one, then run these commands to check:

python --version
py --version

The py command is the Windows Python Launcher, which should automatically detect your installed Python versions if the PATH is set correctly.

4. If all else fails: Reinstall Python with PATH enabled

If you still can't find the correct path or the above steps don't work, try reinstalling Python 3.10:

  • Grab the Python 3.10 installer again
  • Run the installer and make sure to check the box that says Add Python to PATH before proceeding with the installation
  • Choose the Modify option if you're reinstalling over an existing setup

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.30 18:07:39