简体   繁体   English

安装了Anaconda,在Python(Pycharm)中导入numpy

[英]Getting numpy to import in Python (Pycharm), Anaconda installed

I am very new to python and I am trying to write a code to derive a first-order ODE. 我是python的新手,我正在尝试编写一个代码来派生出一阶ODE。 Because of this, I need certain packages (ex. numpy) to do this and installed Anaconda. 因此,我需要某些软件包(例如numpy)才能执行此操作并安装Anaconda。

When I tried to use the "import numpy" command in PyCharm, it did not work. 当我尝试在PyCharm中使用“import numpy”命令时,它不起作用。 I got ModuleNotFoundError: No module named 'numpy'. 我得到了ModuleNotFoundError:没有名为'numpy'的模块。

I am very new and need all the help I can get to get the programs linked. 我很新,需要我能得到的所有帮助才能将程序联系起来。

Thank you! 谢谢!

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. 最佳做法是为每个项目使用单独的Conda环境,然后在项目中安装项目所需的内容。

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: 然后使用右上角的齿轮图标,并选择添加新的本地解释器:

添加一个新的本地解释器

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). 然后,选择左侧的“Conda Environment”,并确保选择所需的Python版本(如果您不确定,3.6是一个不错的选择)。

创建一个新的Conda环境

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: 最后,使用解释器页面上的绿色“+”图标来安装新包,只需查找“Numpy”并从对话框中安装它:

安装Numpy

You need to set your project interpreter to the python, that came with your anaconda installation. 你需要将你的项目解释器设置为你的anaconda安装附带的python。

Your installation path may differ from mine. 您的安装路径可能与我的不同。

For a new project: 对于一个新项目: 新项目设置

If you want to change the settings for an existing project: 如果要更改现有项目的设置: 现有项目的项目设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python:已安装Anaconda,但无法在Jupyter笔记本中导入numpy或matplotlib - Python: Installed Anaconda, but can't import numpy or matplotlib in Jupyter notebook 无法在pyCharm中导入随Anaconda安装的文件:是否需要将Anaconda添加到Python PATH? - Cannot import file installed with Anaconda in pyCharm: Need to add anaconda to Python PATH? 无法导入安装在PyCharm中的anaconda中的软件包 - Can not import package installed in anaconda in PyCharm 导入错误:Anaconda numpy(numpy和Anaconda已安装,virtualenv) - Import error: Anaconda numpy (numpy and Anaconda already installed, virtualenv) 安装Anaconda后无法导入numpy - Can't import numpy after Anaconda installed 在 anaconda 环境中安装了 tensorflow 但无法导入(Tensorflow 1.15、Python 3.6、PyCharm) - Installed tensorflow in an anaconda env but cannot import (Tensorflow 1.15, Python 3.6, PyCharm) 已安装 PyCharm 和 Anaconda,但无法启用 Pandas 和 NumPy - Installed PyCharm and Anaconda, but Can't Enable Pandas and NumPy 用 Anaconda 安装了一个包,无法在 Python 中导入 - Installed a package with Anaconda, can't import in Python 无法将gdal导入到安装了anaconda(MacOSX)的python中 - Unable import gdal into python installed with anaconda (MacOSX) 是否可以从 Anaconda 将 numpy 导入 Python 3.9? - Is it possible to import numpy to Python 3.9 from Anaconda?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM