Drew
Drew

Reputation: 111

Cant import matplotlib on python 2.7.5

I installed matplotlib using (pip install --user matplotlib) and the installation was successful. when I try to import it using (import matplotlib) in python shell I get this error: Traceback (most recent call last): File "", line 1, in import matplotlib ImportError: No module named matplotlib

I couldn't find another question similar to mine because I'm not using anaconda.

Upvotes: 1

Views: 5022

Answers (1)

rawplutonium
rawplutonium

Reputation: 386

Try pip uninstall matplotlib then python -mpip install matplotlib see if it helps. Otherwise, i'd recommend using a virtual environment which you can install using sudo easy_install virtualenv or pip install virtualenv This way you could just install and use matplotlib by following these steps:

  1. Create a new virtual environment : user@yourmac$ virtualenv .env (.env can be any name or directory)
  2. Activate it by doing : user@yourmac$ source .env/bin/activate
  3. Then once it's activated just do a pip install matplotlib and use it to your satisfaction.

Hopefully this should solve your problem.

Upvotes: 0

Related Questions