无法设置Python环境PATH变量?

发布于 2024-12-09 14:52:13 字数 201 浏览 0 评论 0原文

因此,由于某种原因,我的计算机拒绝查看环境 PATH 变量。在路径变量中,我有:

C:\Python32;

与所有其他程序一起列出,但如果我在命令窗口中键入“python”,它就不起作用。但是,我可以在运行窗口中输入“python”,并让它运行正确的解释器(我假设是因为我单独有一个环境变量......?如您所见,我不太明白如何自定义任何帮助将不胜感激!

So for some reason, my computer refuses to see the environment PATH variable. In the path variable, I have:

C:\Python32;

listed, along with all of the other programs, but it doesn't work if I type, "python" into the command window. However, I can type "python" into the run window, and have it run the correct interpreter (I assume because I have an environment variable for that separately...? As you can see, I don't quite understand how to customize this stuff. Any help would be appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

久伴你 2024-12-16 14:52:13

我遇到了同样的问题。

然而,就我而言,我浏览了 python 的文档,发现了我出错的地方。在最新的Python版本中,如果在cmd中输入“python”,则会显示错误。
同时,对我有用的命令是“py”。

所以我建议任何面临类似问题的人尝试这个 - 'py'

I faced the same issue.

However, in my case, I went through the documentation from python and found where I was making mistake. In the latest python versions, if you type 'python' in cmd, it will show error.
At the same time, the command that worked for me was 'py'.

So I recommend anyone facing a similar problem to try this - 'py'

乖乖兔^ω^ 2024-12-16 14:52:13

我知道已经有一段时间了,但我希望这对其他人有帮助。

我遇到了同样的问题,使其工作的唯一方法是以管理员身份运行 cmd 或 powershell。

I know it's been a while, but I hope this could help someone else.

I had the same problem and the only way to making it work was running cmd or powershell as administrator.

江湖彼岸 2024-12-16 14:52:13

您可以通过查看 echo 的输出来确认 python 是否在您的环境变量中

%path%

请记住,使用控制面板编辑 PATH 变量后,您必须打开一个新终端,因为设置将不在现有终端中更新。

另一种可能性是您向 PATH 变量添加了错误的路径。验证一下。

最重要的是,如果你的 python.exe 目录确实在 PATH 中,那么运行 python 就真的可以工作了。

You can confirm if python is in your environment variables by looking at the output of echo

%path%

Keep in mind that after editing the PATH variable using the control panel, you have to open a new terminal, as the setting will NOT be updated in existing terminals.

Another possibility is that you added the wrong path to the PATH variable. Verify it.

The bottom line is, if the directory of your python.exe is really in PATH, then running python will really work.

冰葑 2024-12-16 14:52:13

尝试一下官方文档中此处所写的内容。

Try what is written here on the official documentation.

彡翼 2024-12-16 14:52:13

我遇到了同样的问题。
将更多特定文件夹添加到您的路径中。
例如,我添加了这个,看起来很有效! :)

C:\Python35-32;C:\Python35-32\Lib\site-packages\;C:\Python35-32\Scripts\;

要检查是否设置成功,请在命令提示符中输入 python

在此处输入图像描述

I faced the same problem.
Add more specific folders to your path.
For example I added this and it seemed to work out! :)

C:\Python35-32;C:\Python35-32\Lib\site-packages\;C:\Python35-32\Scripts\;

To check if it is set successfully, type python in command prompt

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文