无法将“python”项识别为 cmdlet、函数、脚本

出错情况

PS C:\Users\24222> python
python : 无法将“python”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径
正确,然后再试一次。
所在位置 行:1 字符: 1
+ python
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (python:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

解决方法

在powershell中输入下面命令

[Environment]::SetEnvironmentVariable("Path", "$env:Path;D:\Python27", "User")

上面D:\Python27换成你的python目录。重启powershell即可,如果还是不行就重启电脑。

成功

PS C:\Users\24222> python
Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

你可能感兴趣的:(无法将“python”项识别为 cmdlet、函数、脚本)