No module named pyglet

15,323

This line

pyglet in c:\python34\lib\site-packages
                   ^    

means that you installed module for python 3.4. You need to install it for 2.7 instead:

python2.7 -m pip install pyglet

or, which is more reliable in your case

python -m pip install pyglet
Share:
15,323
Dagrooms
Author by

Dagrooms

Professional software developer. Interested in making good software, writing fun games, and playing with robots. Languages: C#, C++, Python "If you want to make an apple pie from scratch, you must first invent the universe." - Carl Sagan

Updated on June 04, 2022

Comments

  • Dagrooms
    Dagrooms almost 2 years

    I'm having a strange issue with pyglet. After running pip install pyglet and restarting my command line application, I'm still unable to run a python script that imports pyglet.

    Error output:

    $ python main.py
    Traceback (most recent call last):
      File "main.py", line 6, in <module>
        from pyglet import image
    ImportError: No module named pyglet
    

    Running pip install pyglet again gives:

    pip install pyglet
    --> Requirement already satisfied (use --upgrade to upgrade): 
        pyglet in c:\python34\lib\site-packages
    

    This is on a Windows 7 machine running Python 2.7, and the script in question can be found here: https://github.com/fogleman/Minecraft/blob/master/main.py

    What's the matter with pyglet?