2

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

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
AAA
  • 695
  • 1
  • 7
  • 21

2 Answers2

2

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

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • I'll add comment since it took me some time.`(PyCharm 2018.3.3)` First you'll need to set up a new system interpreter and select your python interpreter. You can go to `File>Python project>Click Gear and select System interpreter`. Select your desired interpreter. You can now import modules. – NelsonGon Mar 09 '19 at 17:00
0

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.

ktzr
  • 1,625
  • 1
  • 11
  • 25