简体   繁体   English

“site-packages\PIL\image.py”,第 2131 行,保存中...PermissionError:[错误 13] 权限被拒绝:scr.png

[英]“site-packages\PIL\image.py”,line 2131, in save…PermissionError:[error 13] permission denied: scr.png

I have made a python code that takes a screenshot and saves it.我制作了一个 python 代码,它截取并保存它。 Am facing the following Error in saving a piece of code:我在保存一段代码时面临以下错误:

 "site-packages\PIL\image.py",line 2131, in save...PermissionError:[error 13] permission denied: scr.png

Note笔记

Folder permission is set to read/write.文件夹权限设置为读/写。

Piece of code:一段代码:

snapshot = ImageGrab.grab()

    # Using png because it cannot write mode RGBA as JPEG
    file = "scr.png"
    snapshot.save(file)

Move your code to desktop, then your code will automatically work.将您的代码移动到桌面,然后您的代码将自动运行。

Move your code out of Site-Packages to Desktop or somewhere

Try in another directory and put the full path of the image file:尝试在另一个目录中并放置图像文件的完整路径:

file = "path/to/img/scr.png"

or try with sudo or admin prompt或尝试使用 sudo 或管理员提示

暂无
暂无

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

相关问题 PermissionError: [Errno 13] 权限被拒绝:'C:\\\\Program Files\\\\Python35\\\\Lib\\\\site-packages\\\\six.py' - PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\Python35\\Lib\\site-packages\\six.py' “PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.5/site-packages'” 安装 Django - “PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.5/site-packages'” installing Django Pytorch: ValueError: 太多维度: 3 > 2. 9/opt/anaconda3/envs/pytorch/lib/python3.7/site-packages/PIL/Image.py in fromarray(obj, mode) - Pytorch: ValueError: Too many dimensions: 3 > 2. 9/opt/anaconda3/envs/pytorch/lib/python3.7/site-packages/PIL/Image.py in fromarray(obj, mode) 当我尝试安装virtualenv时导致此错误的原因是什么? IOError:[Errno 13]权限被拒绝:'/ Library /Python/2.7/site-packages/virtualenv.py' - What's causing this error when I try and install virtualenv? IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/virtualenv.py' PermissionError:[Errno 13]权限被拒绝:使用PIL读取图像像素数据 - PermissionError: [Errno 13] Permission denied: Read Image pixel data using PIL Pyinstaller和Cython PermissionError:[错误13]权限被拒绝 - Pyinstaller and Cython PermissionError: [Error 13] Permission denied PermissionError: [Errno 13] 权限被拒绝 python 错误 - PermissionError: [Errno 13] Permission denied python error Errno 13 权限被拒绝:'/Library/Python/2.7/site-packages/test-easy-install-18954.pth' - Errno 13 Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-18954.pth' PermissionError: [Errno 13] 权限被拒绝和子进程错误 - PermissionError: [Errno 13] Permission denied and Subprocess error PermissionError:[Errno 13]权限被拒绝:'/code/manage.py' - PermissionError: [Errno 13] Permission denied: '/code/manage.py'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM