
import cv2 #read img = cv2.imread('sample_image.jpg') #show cv2.imshow('image',img) cv2.waitKey(0) cv2.destroyAllWindows() Manipulating images using Python OpenCV.

INSTALL NUMPY FOR PYTHON 3.6 ON MAC INSTALL
run pip install opencv-contrib-python-headless if you need both main and contrib modules (check extra modules listing from OpenCV documentation) Import the package: import cv2.

you can type this instead of pip install cv2. Unable to install cv2 on windows, pip install opencv-python. python3 -c "import cv2" Solution 3: In pip package management, there are 4 different OpenCV packages all using the same namespace, cv2. pip3 install opencv-python to check it has installed correctly run.
INSTALL NUMPY FOR PYTHON 3.6 ON MAC WINDOWS
if you are using windows then go command prompt and type:- > pip install cv2 if it is not working then type :- pip install matplotlib See I have just downloaded opencv2.Press ↵ Enter or ⏎ Return to run the command.

This command will make sure the latest pip files are installed on your system to handle package managing tasks. Type and run python -m pip install -U pip.sudo pip install nose sudo pip install tornado sudo pip install numpy -ignore-installed numpy sudo pip install opencv-python 测试代码.
