简体   繁体   English

python PIL显示图像-文件系统错误

[英]python PIL show image - file system error

I try to take a screenshot and display it with the following code:我尝试截取屏幕截图并使用以下代码显示它:

import pyautogui

im = pyautogui.screenshot()
im.show()

but it says in the console Access is denied.但它在控制台中说Access is denied. and pops a windows error:并弹出窗口错误: 在此处输入图片说明

same error if i save the picture and try to double click it from the explorer (not with python), but I can open it with sublime text for some reason.如果我保存图片并尝试从资源管理器(不是使用 python)双击它,则会出现同样的错误,但由于某种原因,我可以使用 sublime text 打开它。

code used for saving:用于保存的代码:

import pyautogui
import PIL

im = pyautogui.screenshot()
im.save(r'screenshot1.png')
im = PIL.Image.open(r'screenshot1.png')
im.show()

how do i solve this?我该如何解决这个问题? should i change permissions on taking the screenshot somehow?我应该以某种方式更改截取屏幕截图的权限吗?

You need to change the startup type of your Windows license management service.您需要更改 Windows 许可证管理服务的启动类型。 Search for "Services" in your computer, and open the Services Management.在您的计算机中搜索“服务”,然后打开“服务管理”。 Find the Windows license management service, and change the startup type to "Automatic".找到 Windows 许可证管理服务,将启动类型更改为“自动”。 Press "apply" and "ok".按“应用”和“确定”。 Refer to this for visualization of the process.请参阅过程的可视化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM