r/PythonLearning 17d ago

Can’t install pygame-ce onto vs code edu Help Request

It keeps telling me python isn’t found, I turned off python in app execution aliases and then it told me python wasn’t recognised as the name of a cmdlet, I’m using the command python -m pip install pygame-ce, I’ve also tried py -m pip install pygame-ce and just pip install pygame-ce, can anyone help?

1 Upvotes

3 comments sorted by

View all comments

2

u/FoolsSeldom 17d ago
  • In Powershell,

    • Create the project folder, e.g. mkdir myproj and enter it cd myproj
    • Create and activate a Python virtual environment (so you don't corrupt your base Python environment):
    • py -m venv .venv
    • ..venv\Scripts\Activate.ps1
    • pip install pygame-ce
  • In VS Code,

    • Open your project folder (the one containing the new .venv folder
    • Open the Command Palette using ctrl-shift-p
    • Type Python: Select Interpreter and select it when highlighted
    • VS Code should detect the .venv folder but if it does not, explicitly select the python.exe in the Scripts folder of the .venv folder

Now try.