简体   繁体   English

虽然安装了 numpy,但如果我尝试使用它,我会收到“ModuleNotFoundError”

[英]Although numpy is installed I get an "ModuleNotFoundError" if I try to use it

If i run pip install numpy then I get如果我运行pip install numpy然后我得到

Requirement already satisfied: numpy in /Users/aaditya/.pyenv/versions/3.8.5/lib/python3.8/site-packages (1.19.5)

But if I use import numpy as np in a python file then I get但是,如果我在 python 文件中使用import numpy as np ,那么我会得到

Traceback (most recent call last):
  File "/Users/aaditya/Desktop/Blender_software/Blender_algo_exp/quantity_sol.py", line 1, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'

Although if I run import numpy as np in my terminal directly then it works.虽然如果我直接在终端中运行import numpy as np ,那么它可以工作。 Is there any way to fix this?有没有什么办法解决这一问题?

I think you just need restart Visual Code or Pycharm我认为您只需要重新启动 Visual Code 或 Pycharm

Or you should check python IDE for Visual Studio或者您应该检查 Visual Studio 的 python IDE

Another solution is run command另一种解决方案是运行命令

python3 -m pip install numpy

暂无
暂无

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

相关问题 ModuleNotFoundError虽然已安装包 - ModuleNotFoundError although package is installed 我在Mac上为Python安装了Anaconda3。 但是,当我尝试使用numpy时,它说ImportError:没有名为“ numpy”的模块 - I installed Anaconda3 on my Mac for Python. However when I try to use numpy it says ImportError: No module named 'numpy' 我安装了 Pillow,但我得到“ModuleNotFoundError: No module named 'PIL'” - I installed Pillow but i get “ModuleNotFoundError: No module named 'PIL'” 当我尝试为protobuf生成文件时,出现错误ModuleNotFoundError - When I try to generate files for protobuf I get error ModuleNotFoundError 当我尝试导入 jupyter notebook(使用 venv)时,安装的包给出了“ModuleNotFoundError” - Installed package giving "ModuleNotFoundError" when I try to import into jupyter notebook (using venv) 安装了一个 python 库但是(从 IDLE 运行它)每当我尝试导入它时它都会返回一个 ModuleNotFoundError - Installed a python library but (running it from IDLE) whenever i try to import it it returns a ModuleNotFoundError 当我尝试使用 pyinstaller 时它声称它没有安装,当我尝试安装它时它声称它已经安装? - When i try to use pyinstaller it claims that it's not installed, when i try to install it it claims it's already installed? ModuleNotFoundError 虽然包已正确安装 - ModuleNotFoundError although package has been installed correctly ModuleNotFoundError:尽管已安装,但没有名为“moviepy”的模块 - ModuleNotFoundError: No module named 'moviepy' although installed ModuleNotFoundError:没有名为“PyDIP”的模块,尽管它已安装 - ModuleNotFoundError: No module named 'PyDIP', although it's installed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM