尝试安装Discord bot cog时出现Python权限错误

时间:2017-11-30 18:09:16

标签: python permissions installation python-3.5 permission-denied

我正在尝试安装Discord bot cog,但我收到了一个错误:

That cog has requirements that I could not install. Check the console for more informations.

所以我检查了控制台。这就是出现的问题。

Collecting mutagen
  Downloading mutagen-1.39.tar.gz (916kB)
    100% |████████████████████████████████| 921kB 587kB/s
Installing collected packages: mutagen
  Running setup.py install for mutagen ... done
Successfully installed mutagen-1.39
Collecting matplotlib
  Downloading matplotlib-2.1.0-cp35-cp35m-win_amd64.whl (8.7MB)
    100% |████████████████████████████████| 8.7MB 136kB/s
Collecting python-dateutil>=2.0 (from matplotlib)
  Using cached python_dateutil-2.6.1-py2.py3-none-any.whl
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib)
  Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 2.6MB/s
Collecting cycler>=0.10 (from matplotlib)
  Downloading cycler-0.10.0-py2.py3-none-any.whl
Collecting pytz (from matplotlib)
  Using cached pytz-2017.3-py2.py3-none-any.whl
Collecting six>=1.10 (from matplotlib)
  Using cached six-1.11.0-py2.py3-none-any.whl
Collecting numpy>=1.7.1 (from matplotlib)
  Using cached numpy-1.13.3-cp35-none-win_amd64.whl
Installing collected packages: six, python-dateutil, pyparsing, cycler, pytz, numpy, matplotlib
Successfully installed cycler-0.10.0 matplotlib-2.1.0 numpy-1.13.3 pyparsing-2.2.0 python-dateutil-2.6.1 pytz-2017.3 six-1.11.0
Exception:
Traceback (most recent call last):
  File "C:\Users\#---No Crossing---#\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Users\#---No Crossing---#\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\commands\install.py", line 423, in run
    shutil.rmtree(target_item_dir)
  File "C:\Users\#---No Crossing---#\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 494, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\Users\#---No Crossing---#\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 384, in _rmtree_unsafe
    _rmtree_unsafe(fullname, onerror)
  File "C:\Users\#---No Crossing---#\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 389, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\#---No Crossing---#\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 387, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\#---No Crossing---#\\Documents\\Red-DiscordBot\\lib\\numpy\\core\\libopenblas_v0.2.20_mingwpy.dll'

然后我又用下一个齿轮尝试了。 开头的错误相同。但是在控制台中:

    Collecting pillow
  Using cached Pillow-4.3.0-cp35-cp35m-win_amd64.whl
Collecting olefile (from pillow)
  Using cached olefile-0.44.zip
Installing collected packages: olefile, pillow
  Running setup.py install for olefile ... done
Successfully installed olefile-0.44 pillow-4.3.0
Exception:
Traceback (most recent call last):
  File "C:\Users\#---No Crossing---#\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "C:\Users\#---No Crossing---#\AppData\Local\Programs\Python\Python35\lib\site-packages\pip\commands\install.py", line 423, in run
    shutil.rmtree(target_item_dir)
  File "C:\Users\#---No Crossing---#\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 494, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "C:\Users\#---No Crossing---#\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 389, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "C:\Users\#---No Crossing---#\AppData\Local\Programs\Python\Python35\lib\shutil.py", line 387, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\#---No Crossing---#\\Documents\\Red-DiscordBot\\lib\\PIL\\_imaging.cp35-win_amd64.pyd'

我知道这是权限的一些错误,但我不确定该怎么做。有人能帮我吗?提前致谢! [我不太了解命令提示符或文件夹权限,所以提供命令会很好:)]再次提前感谢 - 一个刚开始的程序员

1 个答案:

答案 0 :(得分:0)

我找到了答案。 在这里做什么: 1.以管理员身份打开命令提示符(在开始菜单中搜索cmd,右键单击并以管理员身份运行) 2.在takeown /f C:\中键入以下内容: 3.如果操作成功,请关闭命令提示符并转到此PC。 4.右键单击C:\驱动器。 5.单击“属性”。 6.单击窗口顶部的“安全”选项卡。 7.转到您的用户名,然后单击“编辑”。 8.勾选“完整控制”框。 9.保存。 10.再次运行该命令。如果仍然存在,则takeown命令可能没有正确执行。