Python pip3 egg_info 安装时出现错误代码 1 Pygame

Python pip3 egg_info error code 1 while installing Pygame

我最近获得了 python 3.6,我正在安装 python 软件包。到目前为止请求有效,但对于 pygame,我收到错误:

 WARNING, No "Setup" File Exists, Running "config.py"
Using WINDOWS configuration...

Path for SDL not found.
Too bad that is a requirement! Hand-fix the "Setup"
Path for FONT not found.
Path for IMAGE not found.
Path for MIXER not found.
Path for PNG not found.
Path for JPEG not found.
Path for PORTMIDI not found.
Path for COPYLIB_tiff not found.
Path for COPYLIB_z not found.
Path for COPYLIB_vorbis not found.
Path for COPYLIB_ogg not found.

If you get compiler errors during install, doublecheck
the compiler flags in the "Setup" file.


Continuing With "setup.py"
Error with the "Setup" file,
perhaps make a clean copy from "Setup.in".
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Nicholas\AppData\Local\Temp\pip-build-xufd58ed\pygame\setup.py", line 165, in <module>
    extensions = read_setup_file('Setup')
  File "c:\program files\python36\lib\distutils\extension.py", line 171, in read_setup_file
    line = expand_makefile_vars(line, vars)
  File "c:\program files\python36\lib\distutils\sysconfig.py", line 410, in expand_makefile_vars
    s = s[0:beg] + vars.get(m.group(1)) + s[end:]
TypeError: must be str, not NoneType

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Nicholas\AppData\Local\Temp\pip-build-xufd58ed\pygame\

我在安装其他包如pandas时遇到过类似的错误 错误可能是软件包还没有为 python 3.6 或其他东西准备好吗? 我是运行windows10位64位

尼克,请帮忙

我遇到了和你一样的问题

设置

转到此页面:http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame 并下载适合您 Python 和 [= 的 .whl 文件76=]Windows版.

在我的例子中是 pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl 因为我使用 Python 3.6.0Windows 64 位.

接下来,在任务栏的搜索框中输入 cmd,然后按回车键。命令 window 将打开。

在命令中输入以下内容:

pip install setuptools
pip install wheel
pip install --upgrade setuptools
pip install --upgrade wheel

安装时有两个选择 pygame:

选项 1 - 在 Python 文件夹中

将您之前下载的文件粘贴到 Python 文件夹中(在我的例子中是 C:\Python)。

如果您下载了 pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl,请安装 pygame

pip install pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl

(或者将pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl更改为您下载的文件的名称,如果它与我的不同)。

在输入上一个命令之前,确保您下载的文件位于 Python 文件夹中(在我的例子中C:\Python\pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl)并且您复制整个文件名,包括 .whl 扩展名,否则它将无法工作。

选项 2 - 在桌面上

将您之前下载的文件粘贴到桌面上。

如果您将 .whl 文件放在桌面上,请输入以下内容以更改当前目录:

cd "C:\Users\(your_username)\Desktop"

然后,如果您下载了 pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl,请安装 pygame

pip install pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl

(或者将pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl更改为您下载的文件的名称,如果它与我的不同)。

在输入上一个命令之前,请确保更改了当前目录并复制了包括 .whl 扩展名在内的整个文件名,否则它将无法工作

这应该安装 pygame 1.9.2 并在 Python 3.6.0 上工作。