【问题标题】:Error when installing Pygame (1.9.3) on Windows在 Windows 上安装 Pygame (1.9.3) 时出错
【发布时间】:2017-12-05 23:16:23
【问题描述】:

这个问题已经在互联网上被问了很多,但直到现在我还没有发现有人遇到和我一样的错误(也许我不够努力,谁知道呢)。

我正在使用 Windows 10 64 位 Acer 笔记本电脑(我不知道任何其他规格,它不是我的)并尝试安装 pygame‑1.9.3‑cp36‑cp36m‑win32。 whl(有人告诉我最好同时获得 Python 和 Pygame 的 32 位版本)。当我进入 PowerShell 时收到此错误:

PS C:\Program Files (x86)\Python36-32\Scripts> pip3 install pygame-1.9.3-cp36-cp36m-win32.whl
Processing c:\program files (x86)\python36-32\scripts\pygame-1.9.3-cp36-cp36m-win32.whl
Installing collected packages: pygame
Exception:
Traceback (most recent call last):
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "c:\program files (x86)\python36-32\lib\site-packages\pip\utils\__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "c:\program files (x86)\python36-32\lib\os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python36-32\\Lib\\site-packages\\pygame'

不太清楚发生了什么。如果有人这样做,提前非常感谢。

【问题讨论】:

  • @skrx 没有“以管理员身份运行”选项,更不用说“运行”了,无论我在哪里右键单击。
  • 右键cmd或者powershell。
  • @skrx 天哪,谢谢你,我现在感觉自己像个白痴。
  • 没问题。可能发生在我们所有人身上。 ;)

标签: python pygame


【解决方案1】:

在您的情况下,这似乎是一个权限问题,因此请尝试以管理员身份运行它。如果它不起作用,这是我的建议:

在我找到这个 repo 之前,我一直在 windows 中安装 python 库时遇到问题,它从未让我失望。我已经从这里安装了 pygame 20 次,并且总是有效。试试看,让我知道: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

【讨论】:

  • 那么你走在正确的道路上。以管理员身份打开终端(cmd),然后重试。
  • 没问题,很乐意帮助 ;-)
猜你喜欢
  • 1970-01-01
  • 2018-12-11
  • 2012-02-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多