Importing Pyglet
I have attempted to install Pyglet using pip3, and it appears to have been successful. However, when I attempt to import it, I receive the following message (using the console):
PyDev console: starting.
Python 3.7.1 (v3.7.1:260ec2c36a, Oct 20 2018, 14:05:16) [MSC v.1915 32 bit (Intel)] on win32
import pyglet
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.2.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'pyglet'
I uninstalled and reinstalled Pyglet, but got the same result. I even uninstalled and reinstalled PyCharm, and the Python interpreter itself, but still no luck. This seems to have happened when I created a second project. I'm a newbie at all this, so any help would be appreciated.
请先登录再写评论。
Hi,
Please try doing it from the command line (outside of PyCharm) using the same interpreter. Do you have the same error?
If I import directly from the interpreter command line outside of PyCharm, the import is successful. Now, how do I get this to work within PyCharm?
Please attach a screenshot of your Project Interpreter (Settings | Project | Project Interpreter) and a screenshot of your Python Console settings (Settings | Build, Execution, Deployment | Console | Python Console).
Hello Sergey,
I was finally successful in getting this to work. I had different instances of the interpreter resident on my machine. I solved the issue by uninstalling all of the Python interpreters and reinstalling only the 32-bit version from the python.org. All of the packages now appear on the "project interpreter" screen, and I can now import Pyglet without difficulty. Thanks for your help. I am a novice at this.