Not able use installed modules

Mats Wichmann mats at python.org
Fri May 8 11:31:55 EDT 2020


On 5/6/20 10:15 PM, Music lover wrote:
> Hello python team,
>           I have installed the latest version of python from your site.
> Then I successfully installed some modules like :- numpy , pandas,
> matplotlib  from command prompt. But I am not able to use them while
> programing in python Idle. It's saying " no module named 'matplotlib' ."
> 
> 
> Please help me as soon as possible.
> 
> Thanks and regards
> 

As a general answer, this is *always* a problem with paths.  Your
installation of modules went somewhere your Python doesn't know where to
look, which is that Python's value of sys.path. It probably went into a
version-specific location in the sys.path of a different Python as
Souvik has suggested.

Usually if you ran "pip install something" and then can't find
"something" that means pip does not map to the Python you're going to
use.  As a result, it's better to use the following, with MYPYTHON being
code for the way you expect to invoke Python - that could be "python" or
"python3" or "py" or "py -3.8" or whatever it happens to be:

MYPYTHON -m pip install something

calling it as a module means things will be right for whatever MYPYTHON
is, rather than picking up the first executable called pip, which might
not be for that one.

FWIW, many people who are after the set of numpy, pandas, etc. opt to
use Anaconda which specifically aims to make the unified installation of
Python with matching scientific, numeric, data science, etc. modules in
a way that won't give you the kind of headache you are encountering.



More information about the Python-list mailing list