-1

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:\Users\M0182965\PycharmProjects\EMC2.00\venv\Scripts\python.exe C:/Users/M0182965/PycharmProjects/EMC2.00/main.py 
Traceback (most recent call last):
  File "C:\Users\M0182965\PycharmProjects\EMC2.00\main.py", line 1, in <module>
    import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'

Process finished with exit code 1
  • 2
    You just have to install pip before using it https://phoenixnap.com/kb/install-pip-windows –  Aug 24 '22 at 10:54
  • doesnt work sadly – mahle-majstr Aug 24 '22 at 11:14
  • 1
    why it doesn't work? edit your question with all the steps following the tutorial that you have executed and at which point it fails. What does the console show when you do `pip help` after having executed the previous commands in the tutorial? –  Aug 24 '22 at 11:17
  • This looks more like a pip problem than matplotlib. Seems like `pip` is not defined in your PATH. Look up how to add variables to your PATH – Michael S. Aug 24 '22 at 11:20
  • how do I do this – mahle-majstr Aug 24 '22 at 11:27
  • 1
    In the tutorial you have clearly a `Step 4: Add Pip to Windows Environment Variables`. Did you even read the tutorial I linked? –  Aug 24 '22 at 12:20
  • Does this answer your question? ['pip' is not recognized as an internal or external command](https://stackoverflow.com/questions/23708898/pip-is-not-recognized-as-an-internal-or-external-command) – Michael S. Aug 24 '22 at 12:20

2 Answers2

2

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:\Users\M0182965\AppData\Local\Programs\Python\Python39\Scripts . 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.

Michael S.
  • 3,050
  • 4
  • 19
  • 34
-2

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

RiveN
  • 2,595
  • 11
  • 13
  • 26