0

I am struggling with getting pygame to work on VS Code. The only thing that seems to be amiss is that these are different versions and they are in different folders: PS C:\Users\rebec\My Drive\VS Code\Python Config> python --version Python 3.9.11 PS C:\Users\rebec\My Drive\VS Code\Python Config> pip --version pip 22.1.2 from C:\Users\rebec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pip (python 3.10)

I have tried uninstalling and installing pygame. I think it's something with the file configs but I just don't know how to fix it. Thanks in advance for the help!

1 Answers1

1

You have two versions of python installed on your computer. One is 3.9.11, and another is 3.10. You installed pygame for python 3.10, and tried to run it with python 3.9.11.

If you want to run your game using the global interpreter (python 3.10, the one where you installed pygame), you will need to switch your interpreter inside VSCode:

  1. Press Ctrl+Shift+P to open a command pallete.
  2. Open Python: Select interpreter.
  3. Set your interpreter to global one.

You might also want to consider using a virtual enviroment to avoid problems like these in the future:

Each virtual environment has its own Python binary (allowing creation of environments with various Python versions) and can have its own independent set of installed Python packages in its site directories, but shares the standard library with the base installed Python.

ignassew
  • 83
  • 5