Import OpenCV under anaconda fails

人盡茶涼 提交于 2019-12-07 16:57:52

问题


I'm trying to use OpenCV under Anaconda for Python2.7.8.final.0. I did a fresh install of Anaconda, followed by import of the latest (win-64) distribution of OpenCV (2.4.9.1-np19py27_0) using the conda tool...all that seemed to work, the new libraries show up from >conda list. Everything is in the default locations.

I ran the launcher, updated and then started spyder, and get the following: From the IPython console prompt:


In [1]: import cv Traceback (most recent call last):

File "", line 1, in import cv

File "C:\Anaconda\lib\site-packages\cv.py", line 1, in from cv2.cv import *

ImportError: DLL load failed: The specified module could not be found.


Ok, looks like a simple path issue right? Similar questions have been answered saying as much. I go off to look at PYTHONPATH. In Spyder I find a tool, "PYTHONPATH manager," which shows no path. Earlier help says the path being misleading is bad, commenting out was the fix, so what should it be?

A second item from the tool menu looks directly at the Windows environment. "HKEY_CURRENT_USER\Environment" key "Path" is blank.

Actually, right-clicking on the python console options sometimes gives a view of many more environment variables. My windows path is:

['C:\Anaconda\lib\site-packages\PyQt4', 'C:\Anaconda\lib\site-packages\PyQt4', 'C:\Anaconda\lib\site-packages\numpy\core', 'C:\Anaconda\Scripts', 'C:\Program Files\Common Files\Microsoft Shared\Windows Live', 'C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live', 'C:\Program Files (x86)\Intel\iCLS Client\', 'C:\Program Files\Intel\iCLS Client\', 'C:\Windows\system32', 'C:\Windows', 'C:\Windows\System32\Wbem', 'C:\Windows\System32\WindowsPowerShell\v1.0\', 'C:\Program Files\Intel\WiFi\bin\', 'C:\Program Files\Common Files\Intel\WirelessCommon\', 'C:\Program Files\Intel\Intel(R) Management Engine Components\DAL', 'C:\Program Files\Intel\Intel(R) Management Engine Components\IPT', 'C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL', 'C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT', 'C:\Program Files (x86)\Windows Live\Shared', 'C:\Program Files (x86)\GitExtensions\', 'C:\Program Files\MiKTeX 2.9\miktex\bin\x64\', 'C:\Anaconda', 'C:\Anaconda\Scripts', '']

which looks pretty thorough.

So, what gives? Did I install it wrong, start it wrong, something else?

Thanks

来源:https://stackoverflow.com/questions/27450961/import-opencv-under-anaconda-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!