Sadegh
Sadegh

Reputation: 412

Unable to compile python with pyglet in Ubuntu

In Ubuntu 15.10,Running

python3.4 sound.py 

leads to this error:

Traceback (most recent call last):
  File "sound.py", line 2, in <module>
    import pyglet
ImportError: No module named 'pyglet'

I already installed pyglet with running this command:

sudo easy_install -U pyglet

resulting

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

I am confused about what is missing. I guess there are some confusion about different verions of python, pyglet or Ubuntu.

Upvotes: 0

Views: 140

Answers (1)

Gideon Maina
Gideon Maina

Reputation: 870

From the install output it seems that the installed version of pyglet goes to python 2.7 packages. From your command you are explicitly calling python 3.4 There might be a problem there. python 3.4 will not go to 2.7's packages to check for the module.

I suggest that you call the script using python 2.7. running just python is enough (the default env python)

You can take a look at this question on the installation of python 2 and 3 packages too

Upvotes: 1

Related Questions