Home > Blockchain >  Cannot install pip (matplotlib) on windows in pycharm
Cannot install pip (matplotlib) on windows in pycharm

Time:08-27

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

CodePudding user response:

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 your 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.

CodePudding user response:

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

  • Related