Cannot install pip (matplotlib) on windows in pycharm

Question:

tried program

import matplotlib.pyplot as plt
import numpy as np

xpoints = np.array([1, 8])
ypoints = np.array([3, 10])

plt.plot(xpoints, ypoints)
plt.show()

pip is now installed, after reading michael s question
the "pip install matplotlib " works

however the same thing python error is occuring

C:UsersM0182965PycharmProjectsEMC2.00venvScriptspython.exe C:/Users/M0182965/PycharmProjects/EMC2.00/main.py 
Traceback (most recent call last):
  File "C:UsersM0182965PycharmProjectsEMC2.00main.py", line 1, in <module>
    import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'

Process finished with exit code 1
Asked By: mahle-majstr

||

Answers:

Try adding pip to your environment variables. Press your Windows icon on your keyboard, then start typing "variables". Click on "Edit environment variables" (pictured below):

enter image description here

In your environment variables, click on "Path" then click "Edit". In the edit window, click "New" then paste your path to your pip executable, which looks to be C:UsersM0182965AppDataLocalProgramsPythonPython39Scripts . Look at my path as an example (the highlighted one is where my pip executable is):

enter image description here

Then just keep hitting "Ok" until you’re out of all the windows. Open a fresh terminal and try pip install again. You shouldn’t have to restart your computer but try it if the above doesn’t work.

Answered By: Michael S.

pip install does not work for the virtual environment for the newest pycharm. You need to install via project interpreter for every project individually.

enter image description here

Answered By: mahle-majstr
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.