0

Really struggling with this one, so any help would be greatly appreciated.

I can't seem to install any packages...

But if I then try to import...

I'm guessing that it's something to do with where the downloads should be located but I can't figure out where they should be.

Thank you

paul-shuvo
  • 1,874
  • 4
  • 33
  • 37
11l
  • 73
  • 1
  • 9
  • Maybe your answer lies here: https://stackoverflow.com/questions/51472284/python-pygame-using-spyder, as the problem seems similar. – Gaurav Sharma Jan 31 '21 at 19:37

4 Answers4

1

Thanks to everyone that helped.

For anyone with the same problem, not sure its the ideal solution, but I was using Spyder directly (not through Anaconda). So instead I downloaded Anaconda then installed pygame (any package) via the 'anaconda prompt' and not the cmd, did the trick.

11l
  • 73
  • 1
  • 9
0

if you have more than one python install there could be some confusion between the python and pip commands.

check pip is installing with the same python command by running:

python -m pip install pygame

and from python check the site-packages locations to verify the install; see this answer for details: How do I find the location of my Python site-packages directory?

You'll probably find spyder is setting some paths differently.

anax32
  • 69
  • 2
0

You installed pygame for your python interpreter but you are specifying your script run from IPython - I never use spyder b/c that's an extra layer of complication I don't need, but you should probably check what interpreter spyder is running

and in that prompt (shown in links below) either specify the 'normal' interpreter (the one for which 'pip install XXX' will install XXX for, that is c\users\jason...python39). Or you could do what some other people say and use conda instead of pip to install pygame to your spyder environment. Once again spyder/anaconda/ipython is a big wtfwhy for me, and haven't used it in many years, but from my understanding conda is like a parallel package manager to pip, but for anaconda setup.

How to check which Python interpreter Spyder is running on its console?

which references this, probably the direct solution you need:

How to change python version in anaconda spyder

amchugh89
  • 1,276
  • 1
  • 14
  • 33
-2

Have you tried using the PYCharm IDE to install packages?