Using NumPy with PyCharm

 I have NumPy installed. When I enter code using numpy into the Python shell it executes properly. If I enter it into PyCharm (or IDLE) and try to run it, nothing seems to happen. No errors but no output.

4 comments

Hi Betsey,

Please give us more information to understand your issue, namely:

1. Do you test in Python shell from outside of PyCharm or using built-in Python console?

2. Which interpreter do you use? (system interpreter, virtual env, conda, or anything else?)

3. Can you attach screenshots of your interpreter settings and your run configuration?

I would suggest first to ensure that you have the same environment in your run configuration and your python console. But if you're not sure how to do that, the information I've requested should give us some insight.

0

I tried to answer this but don't know if I succeeded.

I created a new project, Learning.

I entered a program, usingnumpy. (Numpy 1.jpg)

I run it and get an error. (Numpy 2.jpg)

I open the Python shell. (Outside PyCharm)

I enter numpy line by line. (Numpy 3.jpg)

Works fine.

 

Thanks for your help.

GOGO


0

Well, now we can see the error - "no module named 'numpy'"

This means that you need to configure the same project interpreter that you use in the python console on your first screenshot.

Please follow our documentation here: https://www.jetbrains.com/help/pycharm/project-interpreter.html

Ensure that you specify the correct interpreter, it should list numpy in the installed packages. If it doesn't, you can install numpy using pycharm's package manager:

https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html

 

Let us know if you still need help.

0

Please sign in to leave a comment.