首页 > 解决方案 > 错误是: PermissionError: [Errno 13] Permission denied: 'C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\IP.PY'

问题描述

这是我的代码:

import shutil

original = r'C:\Users\Руслан\Desktop\HACKPROG\IP.PY'
target = r'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp'
shutil.move(original,target)

我收到以下错误:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\Руслан\Desktop\HACKPROG\IP.PY", line 24, in <module>
    shutil.move(original,target)
  File "C:\Users\Руслан\AppData\Local\Programs\Python\Python39\lib\shutil.py", line 820, in move
    copy_function(src, real_dst)
  File "C:\Users\Руслан\AppData\Local\Programs\Python\Python39\lib\shutil.py", line 435, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "C:\Users\Руслан\AppData\Local\Programs\Python\Python39\lib\shutil.py", line 264, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\IP.PY'

标签: python

解决方案


您似乎没有写入“启动”文件夹的权限。

您可以通过以管理员身份运行 Python 终端来解决此问题(右键单击 IDLE/cmd 并按以管理员身份运行)。


推荐阅读