1

我最近得到了 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\

安装其他软件包(例如熊猫)时,我遇到了类似的错误,错误可能是软件包还没有为 python 3.6 或其他东西准备好吗?我正在运行 Windows 10 64 位

请帮忙,尼克

4

1 回答 1

1

我和你有同样的问题。

设置

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

就我而言,这是pygame‑1.9.2‑cp36‑cp36m‑win_amd64.whl因为我使用Python 3.6.0Windows 64-bit

接下来,cmd在任务栏上的搜索框中输入,然后按 Enter。将打开一个命令窗口。

在cmd中输入以下内容:

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扩展名在内的整个文件名,否则它将不起作用

这应该安装pygame1.9.2 并在 Python 3.6.0 上运行。

于 2017-01-13T22:41:22.370 回答