[英]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.