AAA
AAA

Reputation: 735

No module named 'numpy' in pycharm

I am quite new to python and pycharm.
I installed python 3.6 through anaconda, and I can see many packages including numpy are installed as I can see them in cmd (im using windows) by typing 'conda list'. Also, it works if i type 'import numpy' in python through window command prompt.

However, if I open pycharm and run "import numpy" there, it gives me 'No module named 'numpy' in pycharm'. May I know whats wrong with my setting? I guess it must be some problem with my interpreter setting.

I think my python is installed in C:\Users\AAA\Anaconda3\python.exe I checked in pycharm, project interpreter is "C:\Users\AAA\PycharmProjects\untitled\venv\Scripts\python.exe"

Should I change it to the one under anaconda3 folder?
What is venv folder under "pycharmprejcts"? Is it a virtual environment? It shows (see the attached screenshot) the base interpreter is the one under anaconda? Should I choose to inherit global site-packages?

Please click here to see the screenshot of my current project interpreter location

Upvotes: 2

Views: 6560

Answers (2)

ktzr
ktzr

Reputation: 1645

You have a virtual environment, this helps keep the dependencies separate between projects. You can set your project interpreter to C:\Users\AAA\Anaconda3\python.exe or install the dependency in your venv, in pycharm you would press alt+enter on the import and press install.

Upvotes: 0

OneCricketeer
OneCricketeer

Reputation: 192023

You should select Conda environment in Pycharm, not create a new, blank Virtualenv

Or at the very least - System interpreter, then find the Python executable for Anaconda

What is venv folder under "pycharmprejcts"? Is it a virtual environment?

Yes, it allows your project to be more portable - you define the minimum set of dependencies for your code rather than rely on everything installed only locally on your machine

Upvotes: 2

Related Questions