简体   繁体   English

ImportError:DLL加载失败:找不到指定的过程。蟒蛇

[英]ImportError: DLL load failed: The specified procedure could not be found. Python

Recently, I have installed a current version of Python(x,y) package (2.7.6.0) and now when I run my python code, it shows an error: 最近,我安装了当前版本的Python(x,y)包(2.7.6.0),现在当我运行我的python代码时,它显示一个错误:

Traceback (most recent call last):
File "D:\Projects\comparison\Lagebestimmung\main.py", line 11,   in <module>
import cv2
ImportError: DLL load failed: The specified procedure could not be found.

I correctly selected opencv module during the installation. 我在安装过程中正确选择了opencv模块。

Also, I use to have an older version of Python(x,y) before in my computer which I uninstalled before installing the new version. 另外,我之前在我的计算机中使用旧版本的Python(x,y),我在安装新版本之前卸载了该版本。 In that version, there was no such problem. 在那个版本中,没有这样的问题。

  1. Use Dependency Walker ( http://www.dependencywalker.com/ ) on your cv2.pyd from 'site-packages'. 在'site-packages'上的cv2.pyd上使用Dependency Walker( http://www.dependencywalker.com/ )。
  2. Look at the higher-left corner, where the library tree is. 查看库树所在的左上角。
  3. Normal libraries have blue or gray icons, find libraries with red icons on the left, like this: http://i.stack.imgur.com/YiEuD.png . 普通库有蓝色或灰色图标,左侧有红色图标库,如下所示: http//i.stack.imgur.com/YiEuD.png
  4. Find API's having a red flag and remember parent library names of the libraries with red icon. 查找具有红色标记的API,并记住带有红色图标的库的库名称。 Red flag means that parent library requires some API, which is absent in the underlying library. 红旗表示父库需要一些API,底层库中不存在这些API。 In my case a library with the red icon is 'kernel32.dll', and it's parent libraries are msvcr90.dll, tbb.dll and the library from 'winsxs', which name's is obscured. 在我的例子中,带有红色图标的库是'kernel32.dll',它的父库是msvcr90.dll,tbb.dll和来自'winsxs'的库,其名称被遮盖了。
  5. Usually a problem can be solved by obtaining correct versions of the parent libraries. 通常可以通过获取父库的正确版本来解决问题。 For example, you are trying to use a DLL, which is compiled for Windows Vista, on Windows XP. 例如,您尝试在Windows XP上使用为Windows Vista编译的DLL。 This DLL imports a 'InitializeCriticalSectionEx' API, which is absent in Windows XP's 'kernel32.dll'. 此DLL导入'InitializeCriticalSectionEx'API,在Windows XP的'kernel32.dll'中不存在。 Obtaining the XP version of your DLL or recompiling it with 'InitializeCriticalSection' instead of 'Ex' will solve the problem. 获取DLL的XP版本或使用“InitializeCriticalSection”而不是“Ex”重新编译它将解决问题。 Another example: you are using OpenCV compiled for use with Qt 4.8.4 and PyQt4, which contains Qt version 4.7. 另一个例子:您正在使用OpenCV编译用于Qt 4.8.4和PyQt4,其中包含Qt版本4.7。 cv2.pyd (which is a DLL, by the way) will refuse to import because certain Qt API's required in your OpenCV are not available in 4.7's DLL's. 顺便说一下,cv2.pyd(这是一个DLL)会拒绝导入,因为你的OpenCV中所需的某些Qt API在4.7的DLL中是不可用的。 The solution is to put Qt libraries version 4.8.4 into your '%PYTHONHOME%\\Lib\\site-packages\\PyQt4' folder or PATH. 解决方案是将Qt库版本4.8.4放入'%PYTHONHOME%\\ Lib \\ site-packages \\ PyQt4'文件夹或PATH中。 I encountered this problem myself when building my own version of OpenCV from git repo. 当我从git repo构建我自己的OpenCV版本时,我自己遇到了这个问题。

Try this: Install opencv for windows. 试试这个:安装opencv for windows。 download it at here : 在这里下载:

http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.4.1/OpenCV-2.4.1.exe/download

Then 然后

 Copy cv2.pyd from C:\opencv\build\python\x86\2.7\ and paste it in the folder python site-packages folder . restart your IDE. 

Make sure numpy is installed. 确保安装了numpy。 If not , get it from here .. 如果没有,从这里得到它..

http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

For programmers using python 3, download a wheel package in order to install OpenCV. 对于使用python 3的程序员,下载一个wheel包以安装OpenCV。

You will need to make sure that NumPy is already installed. 您需要确保已安装NumPy。 Anaconda is a nice package to handle dependencies. Anaconda是一个很好的处理依赖项的包。 You would get numpy out of the box with it. 你可以用它来开箱即用。

Then, download the OpenCV version corresponding to your Python installation version from : http://www.lfd.uci.edu/~gohlke/pythonlibs/ 然后,从http://www.lfd.uci.edu/~gohlke/pythonlibs/下载与您的Python安装版本对应的OpenCV版本

You can find the version of your Python interpreter by running: 您可以通过运行以下命令找到Python解释器的版本:

python --version

In my case as I run C-Python 3.5 , I chose : opencv_python‑3.2.0‑cp 35 ‑cp 35 m‑win_amd64.whl 在我运行C-Python 3.5的情况下,我选择了:opencv_python-3.2.0-cp 35 -cp 35 m-win_amd64.whl

Finally, in the directory you have downloaded the wheel package, run: 最后,在已下载wheel包的目录中,运行:

pip install opencv_python-3.X.X-cpXX-cpXXm-xxxx.whl

我有同样的问题,当我使用ipython [只是在cmd上写ipython如果你安装了ipython]它的工作原理。

the following worked for me. 以下为我工作。 Assuming that Python(X,Y) is installed (and the option for OpenCV was checked at the beginning of the installation), I did the following steps: 假设安装了Python(X,Y)(并且在安装开始时检查了OpenCV的选项),我执行了以下步骤:

  1. Download opencv-2.4.13, and extract file in a given folder. 下载opencv-2.4.13,并提取给定文件夹中的文件。
  2. Copy file "cv2.pyd" (which is a file of 10MB) 复制文件“cv2.pyd”(这是一个10MB的文件)
  3. Replace the file cv2.pyd in the "...\\Lib\\site-packages" folder. 替换“... \\ Lib \\ site-packages”文件夹中的文件cv2.pyd。 You will notice that the original "cv2.pyc" file size is below 2MB. 您会注意到原始的“cv2.pyc”文件大小低于2MB。
  4. Start Python(x,y) and the Spyder. 启动Python(x,y)和Spyder。 Type "cv2. version " in the Python console. 在Python控制台输入“CV2。 版本 ”。 You may get >>> cv2. 你可能会得到>>> cv2。 version -> '2.4.13' 版本 - >'2.4.13'
  5. OpenCV is now working! OpenCV现在正在运行!

暂无
暂无

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

相关问题 将Numpy导入Python:“ ImportError:DLL加载失败:找不到指定的过程。” - Importing Numpy to Python: “ImportError: DLL load failed: The specified procedure could not be found.” python错误ImportError:DLL加载失败:找不到指定的过程。 __load中的文件“ psycopg2 \\ _psycopg.pyc”,第10行 - python error ImportError: DLL load failed: The specified procedure could not be found. File “psycopg2\_psycopg.pyc”, line 10, in __load from matplotlib import ft2font: “ImportError: DLL load failed: The specified procedure could not be found.” - from matplotlib import ft2font: “ImportError: DLL load failed: The specified procedure could not be found.” 导入 pptx 时出错“导入错误:DLL 加载失败:找不到指定的过程。” - Error when Import pptx "ImportError: DLL load failed: The specified procedure could not be found." 导入错误:DLL 加载失败:Uvedená procedura nebyla nalezena。 -propably ?找不到指定的程序。? - ImportError: DLL load failed: Uvedená procedura nebyla nalezena. -propably ?The specified procedure could not be found.? 在Windows XP上安装mapnik失败,并显示消息“ImportError:DLL加载失败:找不到指定的过程。” - Installing mapnik on Windows XP fails with the message “ImportError: DLL load failed: The specified procedure could not be found.” ImportError: DLL 加载失败:找不到指定的程序。 (thinkdsp 和 thinkplot) - ImportError: DLL load failed: The specified procedure could not be found. (thinkdsp and thinkplot) 导入错误:DLL 加载失败:找不到指定的模块。(Keras) - ImportError: DLL load failed: The specified module could not be found.(Keras) MeCab:“ImportError:DLL 加载失败:找不到指定的模块。” - MeCab: “ImportError: DLL load failed: The specified module could not be found.” MeCab:“ ImportError:DLL加载失败:找不到指定的模块。” - MeCab: “ImportError: DLL load failed: The specified module could not be found.”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM