简体   繁体   中英

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

When I run import numpy as np

I get 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. 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)

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. So the solution is to install the package using the IDEs. 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)在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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