Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why Pycharm doesn't find system Python libraries?

I am new in Python and I have this sample code to test some libraries (I’ve installed all needed libraries with pip).

import matplotlib.pyplot as plt
import numpy

myarray = numpy.array([1, 2, 3])
plt.plot(myarray)
plt.xlabel('some x axis')
plt.ylabel('some y axis')
plt.show()

when I run the code from command line (macOS) via command python main.py I get chart as expected. Bud when I run the same code in Pycharm I get an error related to missing libraries.

/Users/jirka/PycharmProjects/sandbox/venv/bin/python
/Users/jirka/PycharmProjects/sandbox/main.py Traceback (most recent
call last): File "/Users/jirka/PycharmProjects/sandbox/main.py",
line 2, in
import matplotlib.pyplot as plt ModuleNotFoundError: No module named ‘matplotlib’

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Process finished with exit code 1

Q: What I have to set in Pycharm to find installed system libraries?

Edit: I just add to the accepted answer that the Python interpreter can be in Pycharm set globally for all projects.

enter image description here

>Solution :

Try file -> Settings -> Project : xxxx -> Python Interpreter
Then change Python interpreter from venv to your local python.exe

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading