[英]ModuleNotFoundError: No module named 'cv2' in Spyder IDE, even after I have successfully installed opencv library using anaconda in my windows pc
I have successfully installed opencv and dlib in my windows pc following this site: https://www.learnopencv.com/install-opencv-3-and-dlib-on-windows-python-only/ I have checked the version of opencv and dlib in cmd which make me sure that these libraries are installed in my windows pc. 我已经在此站点之后的Windows PC中成功安装了opencv和dlib: https ://www.learnopencv.com/install-opencv-3-and-dlib-on-windows-python-only/我已经检查了opencv的版本和cmd中的dlib,这确保我在Windows pc中安装了这些库。 Version checking in CMD
CMD中的版本检查
Now I open spyder which was installed by anaconda as default and I imported cv2 and dlib. 现在,我打开由anaconda默认安装的spyder,并导入了cv2和dlib。 But it gives error as no module named cv2 found, no module named dlib found.
但是由于没有找到名为cv2的模块,也没有找到名为dlib的模块,因此出现错误。
Which step am I missing here? 我在这里错过了哪一步? I am just a starter in programming world.
我只是编程界的入门者。 Thanks for your help in advance.
感谢您的帮助。
You must run Spyder in the same virtual env as you are running your Python instance, in the screenshot. 在屏幕快照中,您必须在与运行Python实例相同的虚拟环境中运行Spyder。
You can do that by first installing Spyder in the virtual env, like so, 您可以通过先在虚拟环境中安装Spyder来做到这一点,就像这样,
activate opencv-env
conda install spyder
and then calling the spyder
executable from the same console. 然后从同一控制台调用
spyder
可执行文件。
That should do the trick. 这应该够了吧。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.