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