OpenCV Development (1)--OPENCV3.4+PYTHON3.5+WINDOWS10 Installation problem Solving

Source: Internet
Author: User
Tags visual studio 2010

OpenCV in recent years, the function of increasing, target detection, tracking and other aspects of a number of new algorithms. Since version 3.3, the features of the fiery deep neural network have also been added. The early OPENCV only supported the simple video playback feature, and now some of the ffmpeg features are incorporated. To verify the effect of the new feature, prepare to run a few programs under Python to see the effect. However, the process of configuration is a little cumbersome.
First open the Anaconda prompt input
pip install opencv-python
Anaconda will then automatically install PYTHON-3.4.0.12-CP35-CP35M-WIN_AMD64.WHL and prompt for a successful installation.
At this point, open the Spyder new file cvtest.py and enter

import cv2 as cv   #读入图片文件  src=cv.imread(‘text.jpg‘)  #创建一个名字加 “ input image ” 的窗口,  # 窗口可以根据图片大小自动调整  cv.namedWindow(‘input image‘,cv.WINDOW_AUTOSIZE)  #在窗口显示图片  cv.imshow(‘input image‘,src)    #等待用户操作  cv.waitKey(0)  #释放所有窗口  cv.destroyAllWindows()

When you run the program, you are prompted with the following error:

Importerror:dll load failed: The specified module could not be found.

To find out why, open the PyPI website, search for the Opencv-python package, and open its homepage. There is a description of the problem in the answer:

Q:import fails on the Windows to some DLL load error?
A:If the import fails on Windows, make sure you have Visual C + + redistributable installed. If you are using older Windows version than Windows Ten and latest system updates is not installed, Universal C Runtime mi Ght be also required.

This means that you want to install Visual C + + Redistributable 2015, but you cannot install it after downloading, prompting you to install the associated package as shown in.

So in the Anaconda began to find the library file, the results only found under anaconda3\lib\site-packages\cv2\build opencv_ffmpeg340_64.dll file, There are no other DLL files or PYD files provided to Python by OpenCV. Indicates that there is a problem with the PIP installation.
After Baidu, some people say that there are some OpenCV DLL files in the anaconda3\lib\site-packages\ directory, copy them to the cv2 folder, But I installed the opencv3.4, and after the installation did not have these files. Others say that the OPENCV version of the PIP installation is problematic. He solved the problem of installing OpenCV3.2 under Python. So we also open the page to find the version we need (64-bit, uploaded to this site), namely OPENCV_PYTHON?3.4.1+CONTRIB?CP35?CP35M?WIN_AMD64.WHL or opencv_ PYTHON?3.4.1?CP35?CP35M?WIN_AMD64.WHL and download, such as download to F:\tools, then open cmd to switch to the directory and run the PIP command installation:

pip install opencv_python?3.4.1+contrib?cp35?cp35m?win_amd64.whl或pip install opencv_python?3.4.1?cp35?cp35m?win_amd64.whl

If you are not using anaconda, you need to install wheel first. Run cvtest.py again after installation and no longer prompt importerror.
Attached: DLL file in the function view method:

    1. Use VC + + 6.0 dependency to view;
    2. Viewing using the Il disassembler of Visual Studio 2010;
    3. Open the Visual Studio 2010 command-line program, enter
      dumpbin /exports H:\opencv3.4\build\bin\opencv_ffmpeg340_64.dll

      The dynamic library file name here can be entered in the full path, or you can directly drag and drop the DLL file to the command Line window. The output results are as follows:
      These three tools can be found in the Start menu after Visual C + + 6.0 or vsiual Studio 2010 is installed. If not installed, you can search the download related DLL Function View tool, can be viewed after installation.

OpenCV Development (1)--OPENCV3.4+PYTHON3.5+WINDOWS10 Installation problem Solving

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.