无法在 Ubuntu 中使用 pyglet 编译 python
Unable to compile python with pyglet in Ubuntu
在Ubuntu15.10,运行
python3.4 sound.py
导致此错误:
Traceback (most recent call last):
File "sound.py", line 2, in <module>
import pyglet
ImportError: No module named 'pyglet'
我已经用 运行 这个命令安装了 pyglet:
sudo easy_install -U pyglet
结果
Searching for pyglet
Reading https://pypi.python.org/simple/pyglet/
Best match: pyglet 1.2.4
Processing pyglet-1.2.4-py2.7.egg
pyglet 1.2.4 is already the active version in easy-install.pth
Using /usr/local/lib/python2.7/dist-packages/pyglet-1.2.4-py2.7.egg
Processing dependencies for pyglet
Finished processing dependencies for pyglet
我对缺少的内容感到困惑。我猜对 python、pyglet 或 Ubuntu.
的不同版本有些混淆
从安装输出来看,pyglet 的安装版本似乎是 python 2.7 包。从您的命令中,您明确调用 python 3.4 那里可能有问题。 python 3.4 不会去 2.7 的包中检查模块。
我建议您使用python 2.7调用脚本。 运行 只需 python 就足够了(默认环境 python)
你也可以看看这个question安装python 2和3包
在Ubuntu15.10,运行
python3.4 sound.py
导致此错误:
Traceback (most recent call last):
File "sound.py", line 2, in <module>
import pyglet
ImportError: No module named 'pyglet'
我已经用 运行 这个命令安装了 pyglet:
sudo easy_install -U pyglet
结果
Searching for pyglet
Reading https://pypi.python.org/simple/pyglet/
Best match: pyglet 1.2.4
Processing pyglet-1.2.4-py2.7.egg
pyglet 1.2.4 is already the active version in easy-install.pth
Using /usr/local/lib/python2.7/dist-packages/pyglet-1.2.4-py2.7.egg
Processing dependencies for pyglet
Finished processing dependencies for pyglet
我对缺少的内容感到困惑。我猜对 python、pyglet 或 Ubuntu.
的不同版本有些混淆从安装输出来看,pyglet 的安装版本似乎是 python 2.7 包。从您的命令中,您明确调用 python 3.4 那里可能有问题。 python 3.4 不会去 2.7 的包中检查模块。
我建议您使用python 2.7调用脚本。 运行 只需 python 就足够了(默认环境 python)
你也可以看看这个question安装python 2和3包