Search code examples
pythonpygamepycharm

How to install Pygame in PyCharm with error "no such option: --build-dir"


I have created a PyCharm project, updated pip to 22.0.4 and updated setuptools to 62.0.0 (both the latest versions). When I go to the project settings>Project Interpreter>Install and attempt to install pygame, it throws the following error:

Executed command: pip install pygame

Error occured: Non-zero exit code (2)

Proposed solution: Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 'C:\Users\geema\PycharmProjects\smallgame\venv\Scripts\python.exe'.

Usage:   
  C:\Users\geema\PycharmProjects\smallgame\venv\Scripts\python.exe -m pip install [options] <requirement specifier> [package-index-options] ...

  C:\Users\geema\PycharmProjects\smallgame\venv\Scripts\python.exe -m pip install [options] -r <requirements file> [package-index-options] ...

  C:\Users\geema\PycharmProjects\smallgame\venv\Scripts\python.exe -m pip install [options] [-e] <vcs project url> ...

  C:\Users\geema\PycharmProjects\smallgame\venv\Scripts\python.exe -m pip install [options] [-e] <local project path> ...

  C:\Users\geema\PycharmProjects\smallgame\venv\Scripts\python.exe -m pip install [options] <archive url/path> ...

no such option: --build-dir

How can I resolve this issue?


Solution

  • I have managed to simply use the interpreter from another project on my current one, and the interpreter has Pygame on it. I am still not sure as to why the error occurred.