Reputation: 119
I understand that a very similar question has been asked before, but the answer to said question was given in the context of anaconda, which did not help me as I am not familiar with anaconda. Anyhow:
I'm trying to get started with tensorflow in visual studio code, but when I try to type the following:
import matplotlib.pyplot as plt
I get this error: Unable to import 'matplotlib.pyplot'
(along with pylint(import-error) in grayed-out text).
How do I resolve this error without using anaconda? If the answer relates to typing something into a terminal, please specify where the command is supposed to be typed in, as part of why I can't figure this out is because online solutions never specify where a command should go. Thanks!
Upvotes: 2
Views: 434
Reputation: 4045
I recommend getting familiar with the basic concepts of Python first. From the different versions (Python 2.7, Python 3.x), the structure (libraries), and good practices (use virtual environments to sandbox your structure).
pip
(which may install Python2.7 or Python3.x libraries, depending on what you default Python is or in what virtual environment you are currently working).Anyway, open up a command prompt (as you haven't specified your system, I assume windows. => open PowerShell or cmd).
pip3 install matplotlib
This installs the library matplotlib in the root environment. If you have an environment, activate it before issuing this command.
I strongly recommend reading an introduction to Python to get a better overview of the concept of Python.
Upvotes: 1