Getting numpy to import in Python (Pycharm), Anaco

2019-05-10 07:45发布

I am very new to python and I am trying to write a code to derive a first-order ODE. Because of this, I need certain packages (ex. numpy) to do this and installed Anaconda.

When I tried to use the "import numpy" command in PyCharm, it did not work. I got ModuleNotFoundError: No module named 'numpy'.

I am very new and need all the help I can get to get the programs linked.

Thank you!

2条回答
孤傲高冷的网名
2楼-- · 2019-05-10 08:14

The best practice is to use a separate Conda environment for each of your projects, and then install what you need for your project in those.

First, open Settings, and go to Project Settings | Project Interpreter. Then use the gear icon on the top right, and choose to add a new local interpreter:

Add a new local interpreter

Then, choose 'Conda Environment' on the left-hand side, and make sure to choose the Python version you want (if you're not sure, 3.6 is a good choice).

Create a new Conda environment

Finally, use the green '+' icon on the interpreter page to install a new package, just look for 'Numpy' and install it from the dialog there:

Install Numpy

查看更多
Juvenile、少年°
3楼-- · 2019-05-10 08:28

You need to set your project interpreter to the python, that came with your anaconda installation.

Your installation path may differ from mine.

For a new project: new project settings

If you want to change the settings for an existing project: project settings for existing project

查看更多
登录 后发表回答