无法使用 Python 3.7 的 pip 安装 pygame - 命令“python setup.py egg_info”失败,错误代码为 1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/51139635/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 19:45:39  来源:igfitidea点击:

Can't install pygame with pip for Python 3.7 - Command "python setup.py egg_info" failed with error code 1

pythonpippygameinstall

提问by dPatt

I get the below error when trying to install pygame with pip:

尝试使用 pip 安装 pygame 时出现以下错误:

Command "python setup.py egg_info" failed with error code 1 in 
C:\Users\danie\AppData\Local\Temp\pip-install-8zxzuqef\pygame\

I don't know what this means, and when i look up in other places to tells me to fix my environment variables. But it still doesn't work.

我不知道这意味着什么,当我在其他地方查找时告诉我修复我的环境变量。但它仍然不起作用。

采纳答案by skrx

Update:Pygame 1.9.4has been released and you can download and installit with pip again. In Windows I recommend installing it with: py -3.7 -m pip install pygame

更新:Pygame 1.9.4已经发布,您可以再次使用 pip下载并安装它。在 Windows 中,我建议使用以下命令安装它:py -3.7 -m pip install pygame



There are no official precompiled pygame packages for Python 3.7 available yet, so pip install pygamedoesn't work, but you can get a pygame wheel from: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

目前还没有用于 Python 3.7 的官方预编译 pygame 包,因此pip install pygame不起作用,但您可以从以下位置获取 pygame 轮:https: //www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

Download pygame?1.9.3?cp37?cp37m?win_amd64.whlif you have a 64-bit Python version or pygame?1.9.3?cp37?cp37m?win32.whlif you have a 32-bit version. Then open the command-line, navigate to the directory that contains the wheel file and install it with pip:

下载pygame?1.9.3?cp37?cp37m?win_amd64.whl,如果你有一个64位的Python版本或者pygame?1.9.3?cp37?cp37m?win32.whl如果你有一个32位版本。然后打开命令行,导航到包含wheel文件的目录并使用pip安装它:

py -3.7 -m pip install pygame?1.9.3?cp37?cp37m?win_amd64.whl


This solution works only in Windows, so users with other operating systems have to wait and use Python 3.6.

此解决方案仅适用于 Windows,因此使用其他操作系统的用户必须等待并使用 Python 3.6。

回答by Ojas Kale

Try :

尝试 :

py -3.7 -m pip install pygame