Win10 +python3.6 installation OpenCV and Pycharm importing CV2 problematic solutions

Source: Internet
Author: User

First, install the OPENCV

For reference this blog has been written very clearly --------79499598, here I just record the installation process

It should be said that there are two ways to install OPENCV, one way is the PIP installation of Python, another method is to install directly in the Pycharm, but after the attempt to find the second method found errors, such as.

  

The reason for the error is "Try running this command from the system terminal", so we can only use the first method PIP installation.

To install the PIP before installing OpenCV, install the Pip method as follows:

go to the scripts path under the Python installation directory, execute easy_install-3.6.exe pip (because my Python version is 3.6), after executing this command, PIP is installed successfully, Pip function As follows:

  

 After the PIP is installed, then install OPENCV (the other module installation is similar to the following method):

Enter the scripts path under the Python installation directory to execute pip install opencv-python 

  

  这里要查看安装的opencv的版本话需要在,需要在命令行终端(或python自带的IDLE中)运行如下代码即可查看:

  Import Cv2

  Cv2.__version__

The effect is as follows, you can know my OpenCV version is 3.4.0

  

Second, Pycharm import cv2 Problem Solving method

Pip installed OpenCV, but in the Pycharm import Cv2 still will error, this is why? I also Baidu for a while to find a solution, here Reference blog: 77686807 This blog is a good solution to my problem, but the blog method last feeling a bit redundant, only the first step to solve the problem.

  Workaround:

  To determine if the environment variable in the pycharm contains the Python environment lib, look at the method as shown:

  

Click Show All, click on the red circle to see the path of PYCAHRM, and finally see if the path of the yellow circle is added. Note: Only the yellow circle part of the path is added (Site-packages This folder must be included), PYCAHRM to correctly import Cv2.

  

      

  

Win10 +python3.6 installation OpenCV and Pycharm importing CV2 problematic solutions

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.