python - 错误是: PermissionError: [Errno 13] Permission denied: 'C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\IP.PY'

标签 python

这是我的代码:

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 终端来解决此问题(右键单击 IDLE/cmd 并按以管理员身份运行)。

关于python - 错误是: PermissionError: [Errno 13] Permission denied: 'C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\StartUp\\IP.PY' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66596574/

相关文章:

python - 一种快速预览 .ipynb 文件的方法

Python break 函数在 true 时不会结束

python - 选择第一个元素之后的第二个元素

python - 检查某个键是否存在于包含函数返回的多个字典的元组中的任何字典中

Python MySQLdb 错误 - 是什么导致了这个

python - 如何安装Python 3.4及以上版本的日历模块?

Python3 从 URL 下载编码错误的图像

python - 创建不同形状数组的对象数组时如何防止 numpy 广播

python - 在 python 程序中需要制作一个简单的计算器来根据用户的输入做出响应

pythonw.exe 没有响应