I tried installing pygame and win10toast modules using pip and they got installed in the python directory/lib/site-packages
. But in any IDE like PyCharm or VScode non of them were detected and I got ModuleNotFoundError
. But when I used easy_install
, the modules got installed under anaconda3/scripts
and the error was gone too.
Is it because of some issues in my path variable? Or maybe the IDEs are not considering the python directory to search for modules?
How to resolve this as easy_install says that it will be removed in future versions?
In Pycharm (and I assume it's the same for VScode), you would select a Python interpreter either when you create a new project or through the settings menu afterwards.
The packages that you want to use should be installed in the path that belongs to that interpreter or in an environment that uses that interpreter (e.g. conda environment or virtual environment). If you have chosen to use a Python version installed in an Anaconda environment as your project interpreter, then your IDE is not going to look for anything in another Python path (unless it was instructed to do so).
So if you want to install new packages, make sure you have the right environment activated beforehand and then use pip
or conda
, depending on the package manager that you want to use.
For your situation (you seem to use the base conda environment), you can install packages by opening the anaconda prompt, make sure that there is a (base) before the prompt, and type conda install <package_name>
if the package exists on conda and if not you can try pip install <package_name>