“权限被拒绝"尝试在 Windows 10 上运行 Python [英] "Permission Denied" trying to run Python on Windows 10

查看:28
本文介绍了“权限被拒绝"尝试在 Windows 10 上运行 Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎 Windows 10 上的更新在一夜之间破坏了 Python.只是尝试运行 python --version 返回权限被拒绝"错误.三个更新都没有;KB4507453、KB4506991 或 KB4509096 看起来像是罪魁祸首,但问题发生的时间令人怀疑.我希望有一个更简单的修复方法,而不是搞乱回滚.

Seems as though an update on Windows 10 overnight broke Python. Just trying to run python --version returned a "Permission Denied" error. None of the three updates; KB4507453, KB4506991, or KB4509096 look like they'd be the culprit but the timing of the issue is suspicious. Rather than messing with rolling back, I'm hoping there's a simpler fix that I'm missing.

python 的权限是-rwxr-xr-x",除了在安装昨晚的补丁后让 Windows 更新重新启动机器之外,我没有改变任何东西.

The permissions on python are "-rwxr-xr-x" and I haven't changed anything besides letting the Windows update reboot machine after installing last night's patches.

根据系统信息,我运行的是 10.0.18362

According to the System Information, I'm running 10.0.18362

还应该注意,无论我(尝试)是否使用以管理员身份运行"从 git-bash 执行 Python,并且如果我尝试使用 PowerShell,它只会打开 Windows 商店,就好像应用程序不是"t 安装,所以我认为它由于某种原因看不到我的 /c/Users/david/AppData/Local/Microsoft/WindowsApps/ 文件夹的内容.

Should also note that this is happening whether I (try) to execute Python from git-bash using "run as administrator" or not, and if I try using PowerShell, it just opens the Windows store as if the app isn't installed so I'm thinking it can't see the contents of my /c/Users/david/AppData/Local/Microsoft/WindowsApps/ folder for some reason.

我也尝试过重新安装 Python 3.7.4,但这也无济于事.还有什么我应该看的吗?

I've also tried to reinstall Python 3.7.4, but that didn't help either. Is there something else I should be looking at?

推荐答案

据我所知,这是由与最近添加到 Windows 应用商店的 Python 3.7 版本冲突引起的.看起来这在 %USERPROFILE%AppDataLocalMicrosoftWindowsApps 文件夹中添加了两个名为 python.exe 和 python3.exe 的存根",在我的情况下,这是插入 我现有的 Python 可执行文件在 PATH 中的条目之前.

As far as I can tell, this was caused by a conflict with the version of Python 3.7 that was recently added into the Windows Store. It looks like this added two "stubs" called python.exe and python3.exe into the %USERPROFILE%AppDataLocalMicrosoftWindowsApps folder, and in my case, this was inserted before my existing Python executable's entry in the PATH.

将此条目移动到正确的 Python 文件夹下方(部分)更正了问题.

Moving this entry below the correct Python folder (partially) corrected the issue.

纠正它的第二部分是在 Windows 搜索提示中输入 manage app execution aliases 并完全禁用 Python 的商店版本.

The second part of correcting it is to type manage app execution aliases into the Windows search prompt and disable the store versions of Python altogether.

您可能只需要执行第二部分,但在我的系统上,我进行了两项更改,现在一切都恢复正常了.

It's possible that you'll only need to do the second part, but on my system I made both changes and everything is back to normal now.

这篇关于“权限被拒绝"尝试在 Windows 10 上运行 Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆