1

I ran into some problems with some pip installations. I have found a way of installing that works, but I feel like it's wrong.

I installed pygame from the cmd prompt and got this message:

Defaulting to user installation because normal site-packages is not
writeable Requirement already satisfied: pygame in
c:\users\Somenewguy\appdata\roaming\python\python310\site-packages
(2.1.2)

But when I went to pycharm and started my project, I got this message:

Traceback (most recent call last):
   File "C:\Users\Somenewguy\Python Projects\new\main.py", line 1, in <module>
     import pygame
ModuleNotFoundError: No module named 'pygame'

I then did the pygame pip installation from the terminal in pycharm. But this time I installed it directly into the project folder, and that approach worked. This is the only way I can import pygame into my projects which I think is weird.

Why do I have to install this package for each project?

pppery
  • 3,731
  • 22
  • 33
  • 46
Somenewguy
  • 11
  • 1

1 Answers1

1

If you use a virtual-environment, this is the expected behavior. If you don't want to install it every time, use the system environnement.

  • If thats the case, look to see if the repo has a requirements.txt and call `pip install -r requirements.txt` to get all of them. See [this question](https://stackoverflow.com/questions/7225900/how-can-i-install-packages-using-pip-according-to-the-requirements-txt-file-from) – code11 Apr 13 '22 at 20:12