No module named pyglet
Asked Answered
R

2

5

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?

Reverso answered 24/7, 2015 at 14:33 Comment(3)
What do you mean "unable to run"? Are you trying to run it in the same environment you've installed pyglet in?Surprise
are you able to import pyglet alone? Are you using any virtual environment maybe?Korikorie
Can you show an error message? And, preferably, result of running pip install pyglet.Uncharitable
U
9

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
Uncharitable answered 24/7, 2015 at 17:5 Comment(0)
C
-1

i think that u should reinstall pip for a newer version and with the "satisfy" error usually comes up when u have a module already installed.

Cooperage answered 6/1, 2021 at 19:2 Comment(2)
Is this just a guess or based on facts? Did you had the same error got solved with this?Inherence
yep ive got the same error when i had python 3.6Cooperage

© 2022 - 2024 — McMap. All rights reserved.