简体   繁体   English

我已经安装了 Numpy 但是 PyCharm 找不到模块

[英]I have installed Numpy but PyCharm can't find the module

When I run import numpy as np当我运行import numpy as np

I get ModuleNotFoundError: No module named 'numpy'我收到ModuleNotFoundError: No module named 'numpy'

I have tried it in the project I always used, I have tried it in a new project where Conda is the environment used but I always get this error.我在我一直使用的项目中尝试过,我在一个使用 Conda 的环境的新项目中尝试过,但我总是得到这个错误。 I am clueless here.我在这里一无所知。

When I type in the Terminal of my Macbook pip3 install numpy I get the answer that I already have numpy Requirement already satisfied: numpy in /opt/anaconda3/lib/python3.9/site-packages (1.21.5)当我在 Macbook 的终端中输入pip3 install numpy ,我得到的答案是我已经拥有 numpy Requirement already satisfied: numpy in /opt/anaconda3/lib/python3.9/site-packages (1.21.5)

Often, many IDEs (like Spyder, Jupyter Notebook, or PyCharm) installs their own virtual environment of python to keep things easy and simple for them from your global python. even if you have a package installed in your global python, you might not able to use it in your virtual environment since it would have separate package management.通常,许多 IDE(如 Spyder、Jupyter Notebook 或 PyCharm)会安装自己的虚拟环境 python,以便让它们在全局 python 中变得简单。即使您在全局 python 中安装了 package,您也可能无法在您的虚拟环境中使用它,因为它会有单独的 package 管理。 So the solution is to install the package using the IDEs.所以解决方案是使用 IDE 安装 package。 In your case you can do it by using their terminal or using the red bulb (which will appear on the top of your pakage)在你的情况下,你可以通过使用他们的终端或使用红色灯泡(它会出现在你的包装顶部)来完成在此处输入图像描述

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM