Installs the OpenCV method for the specified Python environment (such as Anaconda) __python

Source: Internet
Author: User

Anaconda is a good Python integrated development environment, you can also use Conda or pip to install PYTHON-OPENCV directly, but this installation method after the installation of OPENCV missing video packets, such as the following read video commands

Import cv2
cap = Cv2. Videocapture (' Path/to/your/video.mp4 ')
cap.isopened ()

You will find that the status is always false, and the Read Command Cap.read () also does not read the data. This is because the anaconda of the direct command installation lacks video-related modules, and then we need to compile the installation OpenCV.
There are a lot of tutorials to install OPENCV, and GitHub has a setup script that's good. The address is here: Install OpenCV.
One of the things you should be aware of is that in the CMake process, you have to specify the python environment you want to install, otherwise your Anaconda environment will not be able to use OPENCV:
If you are a Linux environment such as Ubuntu,
-D python_packages_path=/home/user_name/anaconda2/lib/python2.7/site-packages #这里的路径要根据你的具体情况设定
If you are windows, the path for this
-D Python_packages_path = C:\Anaconda\Lib\site-packages

Related Article

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.