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

查看:475
本文介绍了“权限被拒绝";试图在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存储,就好像该应用程序在运行一样.没有安装,因此我认为由于某些原因它无法看到我的/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 Store中最近添加的Python 3.7版本发生冲突而引起的.看起来这像在%USERPROFILE%\AppData\Local\Microsoft\WindowsApps文件夹中添加了两个名为python.exe和python3.exe的存根",在我的情况下,这是在之前插入到PATH中现有的Python可执行文件条目之前

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%\AppData\Local\Microsoft\WindowsApps 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天全站免登陆