赞
踩
Refer to https://wiki.termux.com/wiki/Instructions_for_installing_python_packages#opencv
1. Install python3 and dev
pkg install python python-dev
2. Install tools and libs
pkg install libjpeg-turbo-dev libpng-dev cmake pkg-config
3. Clone opencv from git
git clone https://github.com/opencv/opencv && cd opencv
4. Create build directory
mkdir build && cd build
5. Configure
LDFLAGS=" -llog -lpython3" cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$PREFIX -DBUILD_opencv_python3=on -DBUILD_opencv_python2=off -DWITH_QT=OFF -DWITH_GTK=OFF ..
Don't missing the double dot at the end of command, It means start from the parent folder. After success, execute the following command:
make
make install
Please be noted that make will take a long time.
6. After installed, test it in python
python
>>> import cv2
>>>cv2.__version__
If no error it will print the version
Note: don'tt install python2, cmake will confuse with it and when import cv will face error.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。