小编Gau*_*m J的帖子

在PowerShell中无法识别Python 3.6

我在Windows 10 PC中安装了python 3.6.我也使用Pycharm来制作我的脚本.我在那里跑得很好.但我的问题是我无法在powershell中运行python.我被告知只需在powershell中键入'python',它应该自动启动python.但是,我得到一个错误,说它不被识别.

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\lenovo> python
python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ python
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (python:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)

有人建议输入:

[Environment]::SetEnvironmentVariable("Path", "$enc:Path;C:\Users\lenovo\AppData\Local\Programs\Python\Python36") 
Run Code Online (Sandbox Code Playgroud)

上面代码中给出的路径对我的PC来说是正确的.事实上,Python在我提供上述代码后运行.但是,这是我的问题.每次我关闭并再次打开powershell时,我必须输入上面的代码才能运行python.我尝试在作为管理员运行的Powershell中输入此内容.但是,它不起作用.我甚至尝试重新启动我的电脑,但问题仍然无法解决.

每次我想在新的PowerShell窗口中运行python时,我都希望输入上面的代码.这有点烦人.任何帮助,将不胜感激.谢谢.

python windows powershell

4
推荐指数
2
解决办法
9504
查看次数

标签 统计

powershell ×1

python ×1

windows ×1