没有名为 pyglet 的模块
No module named pyglet
我遇到了一个关于 pyglet 的奇怪问题。在 运行 宁 pip install pyglet
并重新启动我的命令行应用程序后,我仍然无法 运行 导入 pyglet 的 python 脚本。
错误输出:
$ python main.py
Traceback (most recent call last):
File "main.py", line 6, in <module>
from pyglet import image
ImportError: No module named pyglet
运行 pip install pyglet 再次给出:
pip install pyglet
--> Requirement already satisfied (use --upgrade to upgrade):
pyglet in c:\python34\lib\site-packages
这是在 Windows 7 机器 运行ning Python 2.7 上,有问题的脚本可以在这里找到:https://github.com/fogleman/Minecraft/blob/master/main.py
pyglet 怎么了?
这一行
pyglet in c:\python34\lib\site-packages
^
表示您为 python 3.4 安装了模块。您需要为 2.7 安装它:
python2.7 -m pip install pyglet
或者,哪个更可靠
python -m pip install pyglet
我认为你应该为更新的版本重新安装 pip,当你已经安装了一个模块时,通常会出现“满足”错误。
我遇到了一个关于 pyglet 的奇怪问题。在 运行 宁 pip install pyglet
并重新启动我的命令行应用程序后,我仍然无法 运行 导入 pyglet 的 python 脚本。
错误输出:
$ python main.py
Traceback (most recent call last):
File "main.py", line 6, in <module>
from pyglet import image
ImportError: No module named pyglet
运行 pip install pyglet 再次给出:
pip install pyglet
--> Requirement already satisfied (use --upgrade to upgrade):
pyglet in c:\python34\lib\site-packages
这是在 Windows 7 机器 运行ning Python 2.7 上,有问题的脚本可以在这里找到:https://github.com/fogleman/Minecraft/blob/master/main.py
pyglet 怎么了?
这一行
pyglet in c:\python34\lib\site-packages
^
表示您为 python 3.4 安装了模块。您需要为 2.7 安装它:
python2.7 -m pip install pyglet
或者,哪个更可靠
python -m pip install pyglet
我认为你应该为更新的版本重新安装 pip,当你已经安装了一个模块时,通常会出现“满足”错误。