You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request opencv#26564 from shyama7004:improve-macos-install-docs
Improvement of macOS installation guide in documentation opencv#26564
### Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [ ] There is a reference to the original bug report and related work
- [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
To specify Python2 versions, you can replace `PYTHON3_` with `PYTHON2_` in the above parameters.
127
+
Python 2 has reached its end of life. It is recommended to use Python 3 for building Python bindings.
114
128
115
129
-# Build. From build directory execute *make*, it is recommended to do this in several threads
116
130
117
-
For example
131
+
For example:
132
+
133
+
@code{.bash}
134
+
make -j$(sysctl -n hw.ncpu) # runs the build using all available CPU cores
135
+
@endcode
136
+
137
+
-# After building, you can install OpenCV system-wide using:
138
+
139
+
@code{.bash}
140
+
sudo make install
141
+
@endcode
142
+
143
+
-# To use OpenCV in your CMake-based projects through `find_package(OpenCV)`, specify the `OpenCV_DIR` variable pointing to the build or install directory.
144
+
145
+
For example:
146
+
147
+
@code{.bash}
148
+
cmake -DOpenCV_DIR=~/build_opencv ..
149
+
@endcode
150
+
151
+
### Verifying the OpenCV Installation
152
+
153
+
After building (and optionally installing) OpenCV, you can verify the installation by checking the version using Python:
154
+
118
155
@code{.bash}
119
-
make -j7 # runs 7 jobs in parallel
156
+
python3 -c "import cv2; print(cv2.__version__)"
120
157
@endcode
121
158
122
-
-# To use OpenCV in your CMake-based projects through `find_package(OpenCV)` specify `OpenCV_DIR=<path_to_build_or_install_directory>` variable.
159
+
This command should output the version of OpenCV you have installed.
123
160
124
161
@note
125
162
You can also use a package manager like [Homebrew](https://brew.sh/)
126
163
or [pip](https://pip.pypa.io/en/stable/) to install releases of OpenCV only (Not the cutting edge).
164
+
165
+
- Installing via Homebrew:
166
+
167
+
For example:
168
+
169
+
@code{.bash}
170
+
brew install opencv
171
+
@endcode
172
+
173
+
- Installing via pip:
174
+
175
+
For example:
176
+
177
+
@code{.bash}
178
+
pip install opencv-python
179
+
@endcode
180
+
181
+
@note To access the extra modules from `opencv_contrib`, install the `opencv-contrib-python` package using `pip install opencv-contrib-python`.
0 commit comments