IDLE doesn't recognise installed packages
Terry Reedy
tjreedy at udel.edu
Tue Oct 24 02:36:07 EDT 2017
On 10/23/2017 10:23 AM, Daniel Tangemann wrote:
> I've recently downloaded and installed python 3.6. (I had already also 2.7 and 3.2 on my computer) Initially pip was looking in the wrong directory to install to, so I changed that. then it had trouble installing matplotlib, so I decided to get rid of the older versions of python, which srewed things up even more. now scrips that I had written (in 3.6), that were running without errors before, aren't working anymore. I tried reinstalling python, and I tried the repair option multiple times as well. when I look into the python folder, I can see the modules that I have installed (and that I import into those scripts), but the IDLE doesn't see them! what's even more weird, is that "pip list" doesn't bring up anything but pip itself, while typing "pip install matplotlib" returns a message that
> it's already installed. how do I fix this?
> cheers
Recognition of installed packages is done by the python running IDLE and
executing your import statements, by not IDLE. The only effect IDLE
could have is any manipulation of sys.path.
You can find the executable running IDLE with
>>> import sys; sys.executable
'C:\\Programs\\Python37\\pythonw.exe'
Find the sys.path being used with
>>> sys.path
If you run the same binary (minus the 'w' if present), you can find the
sys.path used without IDLE. You can also test imports without IDLE in use.
It is possible that you have more than one binary around, but I cannot
tell from here. To make sure you are running pip with the same binary
as IDLE, enter path-to-binary -m pip <args) on a command line. For
instance, on windows, given the above
path> C:\Programs\Python37\python.exe -m pip list
--
Terry Jan Reedy
More information about the Python-list
mailing list