python - 为什么我无法在 python 中为 'Python Programming for the absolute beginner' 这本书安装 pygame 和 livewires ?

标签 python python-3.x pygame livewires

绝对初学者的Python编程中,它要求您下载pygamelivewires。这本书将您链接到一个页面,您可以在其中下载为这本书制作的一系列文件夹。这些文件夹中包含 pygame 的设置向导和 livewires.bat 文件。

但是,我运行了 pygame 向导,当我在 Python 脚本开头使用 import pygame 时,我收到了这个令人讨厌的错误:

Traceback (most recent call last):
  File "C:\Python34\pygam test.py", line 1, in <module>
    import pygame
  File "C:\Python34\lib\site-packages\pygame\__init__.py", line 95, in <module>
    from pygame.base import *
ImportError: DLL load failed: The specified module could not be found.

当启动器询问何时放置“pygame”或其他内容时,我输入了以下内容:

C:\Python34

这对我来说似乎是正确的。 “livewires”的 .bat 文件目前也不起作用,但我猜那是因为“pygame”不起作用。

旁注:我的 PATH 也链接到 C:\Python34

问题是什么?

最佳答案

您正在使用Python3。 Pygames 安装不适用于 python3。使用此处的提示:https://askubuntu.com/questions/401342/how-to-download-pygame-in-python3-3 .

此外,出于同样的原因,您不会安装 livewires 模块,并且作者提供了 livewires 的修改版本,而不是原始版本。正是出于这个原因,我根据书后的规范重写了 Livewires:https://pypi.python.org/pypi/SuperWires

关于python - 为什么我无法在 python 中为 'Python Programming for the absolute beginner' 这本书安装 pygame 和 livewires ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29497379/

相关文章:

python - 我正在尝试设置一个 if 语句来删除 Sprite ,而图像消失 Sprite 仍然存在(不断激活 if 语句

python - 如何从 pandas 数据帧的不同列中选择多个值

python - PyPy 的统计分析器

python - 如何在 Python 中将嵌套列表转换为字典,其中 lst[0][0] 是键

python - 重写实例方法的 getattribute 并使用方法输入变量

python - 如何在 Pygame 中的两个随机生成的点之间每 20 个像素绘制一个圆圈?

python - 左右翻转 Plotly 水平直方图

python - flask 错误 : "Method Not Allowed The method is not allowed for the requested URL"

python - Python-如何在两个方向上对自己的类执行操作?

python - 绘制给定 x 和 y 坐标的形状 pygame