0

I'm a complete beginner to coding, Python, and anything beyond user-level computing. I've been learning to code with Python and everything was fine until I tried to import a module outside of Python's Standard Library (pyglet).

pip install pyglet worked and now returns:

> Requirement already satisfied: pyglet in 
c:\users\nick\appdata\local\programs\python\python38-32 (1.5.7)

Then I received an error message when running the module in PyCharm.

>C:\Users\Nick\venv\Scripts\python.exe C:/Users/Nick/PycharmProjects/learning1/leaning1.GUI.py
Traceback (most recent call last):
  File "C:/Users/Nick/PycharmProjects/learning1/leaning1.GUI.py", line 1, in <module>
    import pyglet
ModuleNotFoundError: No module named 'pyglet'

Process finished with exit code 1

I think there are a few possible sources for the issue.

  1. I think I might be saving files in multiple directories, so PyCharm is unable to find what I need. If that's the problem please direct me to a resource on learning how to organize files on my computer (something very basic about directories because I know nothing).

  2. I installed python via python.org, but then Microsoft Store was being opened automatically when I tried to check my python version in the command line. I also downloaded Python from Windows Store.

  3. I tried to solve my problems by completely uninstalling PyCharm, Python (windows store), and Python (python.org). I also tried to delete all previous .py files. I don't think I located everything.

  4. I messed with the interpreter settings in PyCharm.

What I really want is to just start over from a clean slate by scrubbing all Python things!

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Nick
  • 1
  • There are several possible reasons for the error you are getting. If you [included Python in your path](https://stackoverflow.com/q/3701646) together with [using and activating your venv](https://stackoverflow.com/questions/14604699) and you set the Project interpreter like shown in the answer below you should be good to go. (If it still doesn't work update your answer to reflect which of these steps you've taken.) – bad_coder Jun 23 '20 at 19:57

1 Answers1

0

There are a few steps you should take to prevent this sort of issue:

  1. Use a virtual environment: steps to create a virtual environment
  2. Verify that PyCharm's project interpreter is the virtual environment you just created (in my example, the project is named cheetah and the virtual environment is also named cheetah): interpreter options
pythomatic
  • 647
  • 4
  • 13