在绝对初学者的Python编程中,它要求您下载pygame和livewires。这本书将您链接到一个页面,您可以在其中下载为这本书制作的一系列文件夹。这些文件夹中包含 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/