Skip to content Skip to sidebar Skip to footer

Trouble Importing Module In Python 2.7

My Mac computer has Python 3.6 and Python 2.7 and I have successfully installed the basic modules such as numpy, scipy and matplotlib, for example, by doing the routine pip install

Solution 1:

find / -iname '*numpy*'

This is a terminal operation not a python command, you can try running that in the terminal to see where it's storing numpy, but you'll probably get the python3's version.

Try:

pip2 uninstall numpy

Then:

pip2 install numpy

It might be due to your machine seeing python3 as your default "python" so pip might actually be installing it again to python3. By denoting pip2 it should be linked to python2 (might actually need to do 'pip2.7'). Hope it helps!


Solution 2:

Perhaps your pip is an alias to pip3. Find it out by pip --version and if so install packages for python 2.7 as pip2.7 install matplotlib


Post a Comment for "Trouble Importing Module In Python 2.7"