install python

mac It comes with its own , Mainly used python3

install opencv

         One way is through homebrew To install , Installation command brew install
opencv@3( without “@3”, Will be installed opencv4,opencv4 Debugging failed , Finally, it will appear symbol not found Dynamic library for bug


Symbol not found:

  Referenced from:

  Expected in: /usr/local/lib/libopencv_dnn.4.5.5.dylib


         Pass in one way cmake To compile the source code .cmake There are two kinds of compilation , One is brew install cmake, use cmake Command to compile ,( After this method is installed ,opencv Library of /usr/local/lib in , Header file in /usr/local/include in , Not easy to find ). One is cmake Program compilation source code .( This approach and brew Are installed in a folder ,brew Is installed on homebrew In the installation folder of ,cmake Program is customized )

install opencv after , Enter commands at the terminal


        import cv2

If there is no prompt, it means opencv Correct installation

vscode debugging

The trickiest part of debugging is #include<opencv2/opencv.hpp> Wavy lines appear , Tips opencv.hpp unfound Error of

         terms of settlement : stay /usr/local/include establish opencv2 Soft links for

ps: It's said on the Internet vscode of c_cpp_properties Medium includepath It doesn't work ,( The specific reason is probably vscode of includepath Does not affect debug, Just matching is useful -- To be verified )

error 2:#include<opencv2/opencv.hpp> appear #include error

        terms of settlement : stay c_cpp_properties Correct setting in compile path.[ Usually /usr/bin/clang++]

error 3:Undefined symbols for architecture arm64:

        terms of settlement :tasks.json of args Last add "`pkg-config --cflags --libs
opencv`"[ This step is mainly to link dynamic libraries ,macos Dynamic libraries are not automatically linked ]

error 4: It is possible to encounter it again c++ Version requirements c++11 Situation of ( Generally, there is no such problem )

        terms of settlement :task.json of args add to "--std=c++11",

Configuration after completion ( Generally, you only need to tasks.json change )





This is mainly a record , Mainly about the general idea and some of the most difficult problems , Sorry for the lack of details

homebrew stay m1 The specific installation process of Baidu .

©2019-2020 Toolsou All rights reserved,
Solve in servlet The Chinese output in is a question mark C String function and character function in language MySQL management 35 A small coup optimization Java performance —— Concise article Seven sorting algorithms (java code ) use Ansible Batch deployment SSH Password free login to remote host according to excel generate create Build table SQL sentence Spring Source code series ( sixteen )Spring merge BeanDefinition Principle of Virtual machine installation Linux course What are the common exception classes ?