How to download packages in Pycharm using anaconda as it's interpreter?

Question:

I have a problem. I am running python 3.10 and Anaconda 3.9 on the same machine. When I use Anaconda 3.9 as my interpreter in Pycharm, and download a package, it will install the package on python 3.10

If put in the terminal pip install pygame, it will tell me requirement already satisfied.
But when I try to import pygame it will say no module named 'pygame'.

NOTE: The problem occurs ONLY with anaconda as my interpreter, not with python 3.10 as my interpreter.

How do I specify on what version I want the package downloaded on ?
And with which command ?

Answers:

I believe the issue is that Anaconda 3.9 interpreter is not activated in the terminal you’re using to install module. Therefore, while executing the command pip install pygame in the terminal, falls back to use the default python interpreter set to your device which is Python 3.10.

Viable Solutions:

  1. Use of virtual environments, which activate by default if exist in the project root folder. (recommended and best practice)

  2. Install module through PyCharm Available Packages.

  3. Use the Anaconda Prompt.

  4. Use the Anaconda Navigator.

Answered By: Asif
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.