Ubuntu16.04+python2.7 오픈cv 구축 3.2.0

75447 단어 설치 구성
Opencv3 설치2.0 과정에서 저는 많은 구덩이를 만났습니다. 이에 기록하겠습니다.Anaconda를 설치한 친구들은 인터넷에 접속하는 방법을 찾아 직접 이용해서 설치하면 많은 구덩이를 피할 수 있다고 조언한다.다음은 참고한 인터넷 강좌와 결합하여 제 설치 과정과 해결 방법을 말씀드리겠습니다.
1. 준비 작업
세 개의 파일을 미리 다운로드하고,https://github.com/hanxuan123/opencv3.2/tree/master/all인터넷 공유에 대한 링크를 드리겠습니다.opencv-3.2.0, ippicv 포함linux_20151201.tgz、opencv_contrib-3.2.0
2. 종속 파일 설치
여기 있는 사람마다 설치해야 할 서류가 다를 수 있는데, 나는https://blog.csdn.net/yifa3588/article/details/78284794이 블로그에서 준 의존 파일을 먼저 설치한 다음에 CMake 보고서에 부족한 의존 파일을 추가하여 터미널에 입력합니다
sudo apt-get install build-essential  
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev  
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

편역
3.1
우선 첫 번째 단계에서 다운로드한 Opencv-3.2.0을 새 폴더에 압축을 풀고, 나의 새 폴더는 Opencv3, Opencv 라고 명명합니다.contrib-3.2는 Opencv-3.2.0에 압축을 풀고 Opencv-3.2.0에 폴더를 새로 만들고build라고 이름을 붙이고 이 파일에서 컴파일합니다.
3.2
cd /home/software/opencv3/opencv-3.2.0/build  #           

3.3
cmake -D CMAKE_BUILD_TYPE=RELEASE \
 -D CMAKE_INSTALL_PREFIX=/usr/local \
 -D INSTALL_C_EXAMPLES=ON \
 -D OPENCV_EXTRA_MODULES_PATH=/home/software/opencv3/opencv-3.2.0/opencv_contrib-3.2.0/modules/  ..   #           ,         

주의: 이것은 중요한 단계입니다. 이 단계는 여러 가지 문제가 발생할 수 있습니다. 직면한 문제에 따라 증상에 따라 약을 처방해야 합니다. 여기에 제가 겪은 문제와 해결 방법을 첨부하여 참고만 하십시오.
...

Checking for module 'gstreamer-base-1.0'
--   No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-video-1.0'
--   No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-app-1.0'
--   No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
--   No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
--   No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-base-0.10'
--   Found gstreamer-base-0.10, version 0.10.36
-- Checking for module 'gstreamer-video-0.10'
--   No package 'gstreamer-video-0.10' found
-- Checking for module 'gstreamer-app-0.10'
--   No package 'gstreamer-app-0.10' found
-- Checking for module 'gstreamer-riff-0.10'
--   No package 'gstreamer-riff-0.10' found
-- Checking for module 'gstreamer-pbutils-0.10'
--   No package 'gstreamer-pbutils-0.10' found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavresample'
--   No package 'libavresample' found
-- Checking for module 'libgphoto2'
--   No package 'libgphoto2' found
-- found IPP (ICV version): 9.0.1 [9.0.1]
-- at: /home/elsa/software/opencv3/opencv-3.2.0/build/3rdparty/ippicv/ippicv_lnx
-- Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
-- Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
-- Could NOT find Atlas (missing:  Atlas_CBLAS_INCLUDE_DIR Atlas_CLAPACK_INCLUDE_DIR Atlas_CBLAS_LIBRARY Atlas_BLAS_LIBRARY Atlas_LAPACK_LIBRARY) 
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
-- Could NOT find JNI (missing:  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 
-- Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) 
-- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
CMake Error at cmake/OpenCVModule.cmake:295 (message):
  No extra modules found in folder:
  /home/software/opencv3/opencv3.2.0/opencv_contrib-3.2.0/modules

  Please provide path to 'opencv_contrib/modules' folder.
Call Stack (most recent call first):
  modules/CMakeLists.txt:7 (ocv_glob_modules)


......


-- 
-- Configuring incomplete, errors occurred!
See also "/home/elsa/software/opencv3/opencv-3.2.0/build/CMakeFiles/CMakeOutput.log".
See also "/home/elsa/software/opencv3/opencv-3.2.0/build/CMakeFiles/CMakeError.log".

이런 상황이 발생하면 기본적으로 실패하기 때문에 제시에 따라 하나하나 메워야 한다.
우선 부족한 의존 패키지를 설치하고 이 알림에 따라
sudo apt-get install \
libgstreamer0.10-dev \ 
libgstreamer-plugins-base0.10-dev \ 
libgstreamer1.0-dev \ 
libgstreamer-plugins-base1.0-dev \ 
gstreamer-plugins-base-devel \
libgphoto2-dev \

물론 cmake를 업그레이드하는 것이 좋습니다. 그렇지 않으면 오류가 발생할 수도 있습니다.
sudo apt-get install cmake

이외에도 ippicv 가 존재할 수 있습니다linux_20151201.tgz 다운로드 실패 질문입니다.이때 첫 번째 단계에서 우리가 미리 다운로드한 이 파일을 보고서에 제시된 경로로 이동할 수 있다.예를 들어/opencv-3.2.0/3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e/이 파일을 찾지 못하면 새로운 터미널에서 다음과 같은 조작을 할 수 있습니다
sudo mv ippicv_linux_20151201.tgz /opencv-3.2.0/3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e 

이후 터미널을 새로 만들고 cmake를 다시 진행할 수 있습니다
하면, 만약, 만약...
-- Configuring done
-- Generating done 

다음 단계를 순서대로 진행할 수 있다
sudo make
sudo make install

테스트
여기 나는python2.7.12 테스트에서 성공했습니다. 다른 버전에서는 cv2 module 테스트를 찾을 수 없음을 알립니다.
XXX:~$ python
Python 3.6.3 |Anaconda, Inc.| (default, Oct 13 2017, 12:02:49) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "", line 1, in <module>
ModuleNotFoundError: No module named 'cv2'
>>> quit()
XXXXX:~$ source activate python2.7
(python2.7) xxxxxxx:~$ python
Python 2.7.14 |Anaconda, Inc.| (default, Mar 27 2018, 17:29:31) 
[GCC 7.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "", line 1, in <module>
ImportError: No module named cv2
>>> 
(python2.7) xxxxxxxx:~$ sudo python
[sudo] xxx   : 
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "", line 1, in <module>
ImportError: /lib/x86_64-linux-gnu/libz.so.1: version `ZLIB_1.2.9' not found (required by /home/software/anaconda3/lib/libpng16.so.16)
>>> 

프롬프트에 따라 ZLIB가 누락되었습니다. 여기서 제공한 도움말을 참조하여 Zlib을 다운로드한 다음 다음, 다음과 같이 수행합니다.
tar -xvf ~/Downloads/zlib-1.2.9.tar.gz
cd zlib-1.2.9
sudo -s
./configure; make; make install
cd /lib/x86_64-linux-gnu
ln -s -f /usr/local/lib/libz.so.1.2.11/lib libz.so.1
cd ~
rm -rf zlib-1.2.11

다운로드 주소 스탬프 여기~
절차는 다음과 같습니다.
XXXX:~$ tar -xvf ~/  /zlib-1.2.11.tar.gz
zlib-1.2.11/
zlib-1.2.11/adler32.c
zlib-1.2.11/amiga/
zlib-1.2.11/ChangeLog
zlib-1.2.11/CMakeLists.txt
zlib-1.2.11/compress.c
zlib-1.2.11/configure
zlib-1.2.11/contrib/
zlib-1.2.11/crc32.c
zlib-1.2.11/crc32.h
zlib-1.2.11/deflate.c
zlib-1.2.11/deflate.h
zlib-1.2.11/doc/
zlib-1.2.11/examples/
zlib-1.2.11/FAQ
zlib-1.2.11/gzclose.c
zlib-1.2.11/gzguts.h
zlib-1.2.11/gzlib.c
zlib-1.2.11/gzread.c
zlib-1.2.11/gzwrite.c
zlib-1.2.11/INDEX
zlib-1.2.11/infback.c
zlib-1.2.11/inffast.c
zlib-1.2.11/inffast.h
zlib-1.2.11/inffixed.h
zlib-1.2.11/inflate.c
zlib-1.2.11/inflate.h
zlib-1.2.11/inftrees.c
zlib-1.2.11/inftrees.h
zlib-1.2.11/make_vms.com
zlib-1.2.11/Makefile
zlib-1.2.11/Makefile.in
zlib-1.2.11/msdos/
zlib-1.2.11/nintendods/
zlib-1.2.11/old/
zlib-1.2.11/os400/
zlib-1.2.11/qnx/
zlib-1.2.11/README
zlib-1.2.11/test/
zlib-1.2.11/treebuild.xml
zlib-1.2.11/trees.c
zlib-1.2.11/trees.h
zlib-1.2.11/uncompr.c
zlib-1.2.11/watcom/
zlib-1.2.11/win32/
zlib-1.2.11/zconf.h
zlib-1.2.11/zconf.h.cmakein
zlib-1.2.11/zconf.h.in
zlib-1.2.11/zlib.3
zlib-1.2.11/zlib.3.pdf
zlib-1.2.11/zlib.h
zlib-1.2.11/zlib.map
zlib-1.2.11/zlib.pc.cmakein
zlib-1.2.11/zlib.pc.in
zlib-1.2.11/zlib2ansi
zlib-1.2.11/zutil.c
zlib-1.2.11/zutil.h
zlib-1.2.11/win32/DLL_FAQ.txt
zlib-1.2.11/win32/Makefile.bor
zlib-1.2.11/win32/Makefile.gcc
zlib-1.2.11/win32/Makefile.msc
zlib-1.2.11/win32/README-WIN32.txt
zlib-1.2.11/win32/VisualC.txt
zlib-1.2.11/win32/zlib.def
zlib-1.2.11/win32/zlib1.rc
zlib-1.2.11/watcom/watcom_f.mak
zlib-1.2.11/watcom/watcom_l.mak
zlib-1.2.11/test/example.c
zlib-1.2.11/test/infcover.c
zlib-1.2.11/test/minigzip.c
zlib-1.2.11/qnx/package.qpg
zlib-1.2.11/os400/bndsrc
zlib-1.2.11/os400/make.sh
zlib-1.2.11/os400/README400
zlib-1.2.11/os400/zlib.inc
zlib-1.2.11/old/descrip.mms
zlib-1.2.11/old/Makefile.emx
zlib-1.2.11/old/Makefile.riscos
zlib-1.2.11/old/os2/
zlib-1.2.11/old/README
zlib-1.2.11/old/visual-basic.txt
zlib-1.2.11/old/os2/Makefile.os2
zlib-1.2.11/old/os2/zlib.def
zlib-1.2.11/nintendods/Makefile
zlib-1.2.11/nintendods/README
zlib-1.2.11/msdos/Makefile.bor
zlib-1.2.11/msdos/Makefile.dj2
zlib-1.2.11/msdos/Makefile.emx
zlib-1.2.11/msdos/Makefile.msc
zlib-1.2.11/msdos/Makefile.tc
zlib-1.2.11/examples/enough.c
zlib-1.2.11/examples/fitblk.c
zlib-1.2.11/examples/gun.c
zlib-1.2.11/examples/gzappend.c
zlib-1.2.11/examples/gzjoin.c
zlib-1.2.11/examples/gzlog.c
zlib-1.2.11/examples/gzlog.h
zlib-1.2.11/examples/README.examples
zlib-1.2.11/examples/zlib_how.html
zlib-1.2.11/examples/zpipe.c
zlib-1.2.11/examples/zran.c
zlib-1.2.11/doc/algorithm.txt
zlib-1.2.11/doc/rfc1950.txt
zlib-1.2.11/doc/rfc1951.txt
zlib-1.2.11/doc/rfc1952.txt
zlib-1.2.11/doc/txtvsbin.txt
zlib-1.2.11/contrib/ada/
zlib-1.2.11/contrib/amd64/
zlib-1.2.11/contrib/asm686/
zlib-1.2.11/contrib/blast/
zlib-1.2.11/contrib/delphi/
zlib-1.2.11/contrib/dotzlib/
zlib-1.2.11/contrib/gcc_gvmat64/
zlib-1.2.11/contrib/infback9/
zlib-1.2.11/contrib/inflate86/
zlib-1.2.11/contrib/iostream/
zlib-1.2.11/contrib/iostream2/
zlib-1.2.11/contrib/iostream3/
zlib-1.2.11/contrib/masmx64/
zlib-1.2.11/contrib/masmx86/
zlib-1.2.11/contrib/minizip/
zlib-1.2.11/contrib/pascal/
zlib-1.2.11/contrib/puff/
zlib-1.2.11/contrib/README.contrib
zlib-1.2.11/contrib/testzlib/
zlib-1.2.11/contrib/untgz/
zlib-1.2.11/contrib/vstudio/
zlib-1.2.11/contrib/vstudio/readme.txt
zlib-1.2.11/contrib/vstudio/vc10/
zlib-1.2.11/contrib/vstudio/vc11/
zlib-1.2.11/contrib/vstudio/vc12/
zlib-1.2.11/contrib/vstudio/vc14/
zlib-1.2.11/contrib/vstudio/vc9/
zlib-1.2.11/contrib/vstudio/vc9/miniunz.vcproj
zlib-1.2.11/contrib/vstudio/vc9/minizip.vcproj
zlib-1.2.11/contrib/vstudio/vc9/testzlib.vcproj
zlib-1.2.11/contrib/vstudio/vc9/testzlibdll.vcproj
zlib-1.2.11/contrib/vstudio/vc9/zlib.rc
zlib-1.2.11/contrib/vstudio/vc9/zlibstat.vcproj
zlib-1.2.11/contrib/vstudio/vc9/zlibvc.def
zlib-1.2.11/contrib/vstudio/vc9/zlibvc.sln
zlib-1.2.11/contrib/vstudio/vc9/zlibvc.vcproj
zlib-1.2.11/contrib/vstudio/vc14/miniunz.vcxproj
zlib-1.2.11/contrib/vstudio/vc14/minizip.vcxproj
zlib-1.2.11/contrib/vstudio/vc14/testzlib.vcxproj
zlib-1.2.11/contrib/vstudio/vc14/testzlibdll.vcxproj
zlib-1.2.11/contrib/vstudio/vc14/zlib.rc
zlib-1.2.11/contrib/vstudio/vc14/zlibstat.vcxproj
zlib-1.2.11/contrib/vstudio/vc14/zlibvc.def
zlib-1.2.11/contrib/vstudio/vc14/zlibvc.sln
zlib-1.2.11/contrib/vstudio/vc14/zlibvc.vcxproj
zlib-1.2.11/contrib/vstudio/vc12/miniunz.vcxproj
zlib-1.2.11/contrib/vstudio/vc12/minizip.vcxproj
zlib-1.2.11/contrib/vstudio/vc12/testzlib.vcxproj
zlib-1.2.11/contrib/vstudio/vc12/testzlibdll.vcxproj
zlib-1.2.11/contrib/vstudio/vc12/zlib.rc
zlib-1.2.11/contrib/vstudio/vc12/zlibstat.vcxproj
zlib-1.2.11/contrib/vstudio/vc12/zlibvc.def
zlib-1.2.11/contrib/vstudio/vc12/zlibvc.sln
zlib-1.2.11/contrib/vstudio/vc12/zlibvc.vcxproj
zlib-1.2.11/contrib/vstudio/vc11/miniunz.vcxproj
zlib-1.2.11/contrib/vstudio/vc11/minizip.vcxproj
zlib-1.2.11/contrib/vstudio/vc11/testzlib.vcxproj
zlib-1.2.11/contrib/vstudio/vc11/testzlibdll.vcxproj
zlib-1.2.11/contrib/vstudio/vc11/zlib.rc
zlib-1.2.11/contrib/vstudio/vc11/zlibstat.vcxproj
zlib-1.2.11/contrib/vstudio/vc11/zlibvc.def
zlib-1.2.11/contrib/vstudio/vc11/zlibvc.sln
zlib-1.2.11/contrib/vstudio/vc11/zlibvc.vcxproj
zlib-1.2.11/contrib/vstudio/vc10/miniunz.vcxproj
zlib-1.2.11/contrib/vstudio/vc10/miniunz.vcxproj.filters
zlib-1.2.11/contrib/vstudio/vc10/minizip.vcxproj
zlib-1.2.11/contrib/vstudio/vc10/minizip.vcxproj.filters
zlib-1.2.11/contrib/vstudio/vc10/testzlib.vcxproj
zlib-1.2.11/contrib/vstudio/vc10/testzlib.vcxproj.filters
zlib-1.2.11/contrib/vstudio/vc10/testzlibdll.vcxproj
zlib-1.2.11/contrib/vstudio/vc10/testzlibdll.vcxproj.filters
zlib-1.2.11/contrib/vstudio/vc10/zlib.rc
zlib-1.2.11/contrib/vstudio/vc10/zlibstat.vcxproj
zlib-1.2.11/contrib/vstudio/vc10/zlibstat.vcxproj.filters
zlib-1.2.11/contrib/vstudio/vc10/zlibvc.def
zlib-1.2.11/contrib/vstudio/vc10/zlibvc.sln
zlib-1.2.11/contrib/vstudio/vc10/zlibvc.vcxproj
zlib-1.2.11/contrib/vstudio/vc10/zlibvc.vcxproj.filters
zlib-1.2.11/contrib/untgz/Makefile
zlib-1.2.11/contrib/untgz/Makefile.msc
zlib-1.2.11/contrib/untgz/untgz.c
zlib-1.2.11/contrib/testzlib/testzlib.c
zlib-1.2.11/contrib/testzlib/testzlib.txt
zlib-1.2.11/contrib/puff/Makefile
zlib-1.2.11/contrib/puff/puff.c
zlib-1.2.11/contrib/puff/puff.h
zlib-1.2.11/contrib/puff/pufftest.c
zlib-1.2.11/contrib/puff/README
zlib-1.2.11/contrib/puff/zeros.raw
zlib-1.2.11/contrib/pascal/example.pas
zlib-1.2.11/contrib/pascal/readme.txt
zlib-1.2.11/contrib/pascal/zlibd32.mak
zlib-1.2.11/contrib/pascal/zlibpas.pas
zlib-1.2.11/contrib/minizip/configure.ac
zlib-1.2.11/contrib/minizip/crypt.h
zlib-1.2.11/contrib/minizip/ioapi.c
zlib-1.2.11/contrib/minizip/ioapi.h
zlib-1.2.11/contrib/minizip/iowin32.c
zlib-1.2.11/contrib/minizip/iowin32.h
zlib-1.2.11/contrib/minizip/make_vms.com
zlib-1.2.11/contrib/minizip/Makefile
zlib-1.2.11/contrib/minizip/Makefile.am
zlib-1.2.11/contrib/minizip/miniunz.c
zlib-1.2.11/contrib/minizip/miniunzip.1
zlib-1.2.11/contrib/minizip/minizip.1
zlib-1.2.11/contrib/minizip/minizip.c
zlib-1.2.11/contrib/minizip/minizip.pc.in
zlib-1.2.11/contrib/minizip/MiniZip64_Changes.txt
zlib-1.2.11/contrib/minizip/MiniZip64_info.txt
zlib-1.2.11/contrib/minizip/mztools.c
zlib-1.2.11/contrib/minizip/mztools.h
zlib-1.2.11/contrib/minizip/unzip.c
zlib-1.2.11/contrib/minizip/unzip.h
zlib-1.2.11/contrib/minizip/zip.c
zlib-1.2.11/contrib/minizip/zip.h
zlib-1.2.11/contrib/masmx86/bld_ml32.bat
zlib-1.2.11/contrib/masmx86/inffas32.asm
zlib-1.2.11/contrib/masmx86/match686.asm
zlib-1.2.11/contrib/masmx86/readme.txt
zlib-1.2.11/contrib/masmx64/bld_ml64.bat
zlib-1.2.11/contrib/masmx64/gvmat64.asm
zlib-1.2.11/contrib/masmx64/inffas8664.c
zlib-1.2.11/contrib/masmx64/inffasx64.asm
zlib-1.2.11/contrib/masmx64/readme.txt
zlib-1.2.11/contrib/iostream3/README
zlib-1.2.11/contrib/iostream3/test.cc
zlib-1.2.11/contrib/iostream3/TODO
zlib-1.2.11/contrib/iostream3/zfstream.cc
zlib-1.2.11/contrib/iostream3/zfstream.h
zlib-1.2.11/contrib/iostream2/zstream.h
zlib-1.2.11/contrib/iostream2/zstream_test.cpp
zlib-1.2.11/contrib/iostream/test.cpp
zlib-1.2.11/contrib/iostream/zfstream.cpp
zlib-1.2.11/contrib/iostream/zfstream.h
zlib-1.2.11/contrib/inflate86/inffas86.c
zlib-1.2.11/contrib/inflate86/inffast.S
zlib-1.2.11/contrib/infback9/infback9.c
zlib-1.2.11/contrib/infback9/infback9.h
zlib-1.2.11/contrib/infback9/inffix9.h
zlib-1.2.11/contrib/infback9/inflate9.h
zlib-1.2.11/contrib/infback9/inftree9.c
zlib-1.2.11/contrib/infback9/inftree9.h
zlib-1.2.11/contrib/infback9/README
zlib-1.2.11/contrib/gcc_gvmat64/gvmat64.S
zlib-1.2.11/contrib/dotzlib/DotZLib/
zlib-1.2.11/contrib/dotzlib/DotZLib.build
zlib-1.2.11/contrib/dotzlib/DotZLib.chm
zlib-1.2.11/contrib/dotzlib/DotZLib.sln
zlib-1.2.11/contrib/dotzlib/LICENSE_1_0.txt
zlib-1.2.11/contrib/dotzlib/readme.txt
zlib-1.2.11/contrib/dotzlib/DotZLib/AssemblyInfo.cs
zlib-1.2.11/contrib/dotzlib/DotZLib/ChecksumImpl.cs
zlib-1.2.11/contrib/dotzlib/DotZLib/CircularBuffer.cs
zlib-1.2.11/contrib/dotzlib/DotZLib/CodecBase.cs
zlib-1.2.11/contrib/dotzlib/DotZLib/Deflater.cs
zlib-1.2.11/contrib/dotzlib/DotZLib/DotZLib.cs
zlib-1.2.11/contrib/dotzlib/DotZLib/DotZLib.csproj
zlib-1.2.11/contrib/dotzlib/DotZLib/GZipStream.cs
zlib-1.2.11/contrib/dotzlib/DotZLib/Inflater.cs
zlib-1.2.11/contrib/dotzlib/DotZLib/UnitTests.cs
zlib-1.2.11/contrib/delphi/readme.txt
zlib-1.2.11/contrib/delphi/ZLib.pas
zlib-1.2.11/contrib/delphi/ZLibConst.pas
zlib-1.2.11/contrib/delphi/zlibd32.mak
zlib-1.2.11/contrib/blast/blast.c
zlib-1.2.11/contrib/blast/blast.h
zlib-1.2.11/contrib/blast/Makefile
zlib-1.2.11/contrib/blast/README
zlib-1.2.11/contrib/blast/test.pk
zlib-1.2.11/contrib/blast/test.txt
zlib-1.2.11/contrib/asm686/match.S
zlib-1.2.11/contrib/asm686/README.686
zlib-1.2.11/contrib/amd64/amd64-match.S
zlib-1.2.11/contrib/ada/buffer_demo.adb
zlib-1.2.11/contrib/ada/mtest.adb
zlib-1.2.11/contrib/ada/read.adb
zlib-1.2.11/contrib/ada/readme.txt
zlib-1.2.11/contrib/ada/test.adb
zlib-1.2.11/contrib/ada/zlib-streams.adb
zlib-1.2.11/contrib/ada/zlib-streams.ads
zlib-1.2.11/contrib/ada/zlib-thin.adb
zlib-1.2.11/contrib/ada/zlib-thin.ads
zlib-1.2.11/contrib/ada/zlib.adb
zlib-1.2.11/contrib/ada/zlib.ads
zlib-1.2.11/contrib/ada/zlib.gpr
zlib-1.2.11/amiga/Makefile.pup
zlib-1.2.11/amiga/Makefile.sas
XXXX:~$ cd zlib-1.2.11
XXXX:~/zlib-1.2.11$ sudo -s
[sudo] XXXX    : 
root@XXXX:~/zlib-1.2.11# ./configure; make; make install
Checking for gcc...
Checking for shared library support...
Building shared library libz.so.1.2.11 with gcc.
Checking for size_t... Yes.
Checking for off64_t... Yes.
Checking for fseeko... Yes.
Checking for strerror... Yes.
Checking for unistd.h... Yes.
Checking for stdarg.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf().
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for attribute(visibility) support... Yes.
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -c -o example.o test/example.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o adler32.o adler32.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o crc32.o crc32.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o deflate.o deflate.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o infback.o infback.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o inffast.o inffast.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o inflate.o inflate.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o inftrees.o inftrees.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o trees.o trees.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o zutil.o zutil.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o compress.o compress.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o uncompr.o uncompr.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o gzclose.o gzclose.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o gzlib.o gzlib.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o gzread.o gzread.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -c -o gzwrite.o gzwrite.c
ar rc libz.a adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o 
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o example example.o -L. libz.a
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -c -o minigzip.o test/minigzip.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o minigzip minigzip.o -L. libz.a
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/adler32.o adler32.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/crc32.o crc32.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/deflate.o deflate.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/infback.o infback.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/inffast.o inffast.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/inflate.o inflate.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/inftrees.o inftrees.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/trees.o trees.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/zutil.o zutil.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/compress.o compress.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/uncompr.o uncompr.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/gzclose.o gzclose.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/gzlib.o gzlib.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/gzread.o gzread.c
gcc -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN  -DPIC -c -o objs/gzwrite.o gzwrite.c
gcc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map -O3 -fPIC -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o libz.so.1.2.11 adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo  -lc 
rm -f libz.so libz.so.1
ln -s libz.so.1.2.11 libz.so
ln -s libz.so.1.2.11 libz.so.1
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o examplesh example.o -L. libz.so.1.2.11
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o minigzipsh minigzip.o -L. libz.so.1.2.11
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -D_FILE_OFFSET_BITS=64 -c -o example64.o test/example.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o example64 example64.o -L. libz.a
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I. -D_FILE_OFFSET_BITS=64 -c -o minigzip64.o test/minigzip.c
gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -o minigzip64 minigzip64.o -L. libz.a
rm -f /usr/local/lib/libz.a
cp libz.a /usr/local/lib
chmod 644 /usr/local/lib/libz.a
cp libz.so.1.2.11 /usr/local/lib
chmod 755 /usr/local/lib/libz.so.1.2.11
rm -f /usr/local/share/man/man3/zlib.3
cp zlib.3 /usr/local/share/man/man3
chmod 644 /usr/local/share/man/man3/zlib.3
rm -f /usr/local/lib/pkgconfig/zlib.pc
cp zlib.pc /usr/local/lib/pkgconfig
chmod 644 /usr/local/lib/pkgconfig/zlib.pc
rm -f /usr/local/include/zlib.h /usr/local/include/zconf.h
cp zlib.h zconf.h /usr/local/include
chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
root@XXXX:~/zlib-1.2.11# cd /lib/x86_64-linux-gnu
root@XXXX:/lib/x86_64-linux-gnu# ln -s -f /usr/local/lib/libz.so.1.2.9/lib libz.so.1
root@XXXX:/lib/x86_64-linux-gnu# cd ~
root@XXXX:~# rm -rf zlib-1.2.11

또한 다음과 같은 문제가 발생할 경우
>>> import cv2
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
  File "", line 1, in <module>
ImportError: numpy.core.multiarray failed to import

numpy와opencv2 버전이 맞지 않기 때문일 수 있으므로 먼저 pip install -U numpy 다시 테스트할 수 있습니다
이쯤에서 테스트하면 OK.
XXXX:~$ sudo python
Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.2.0'
>>> 

5.python3의opencv 설정
이 주소는python2와opencv가 설정된 상태에서python3을 재조합하는 방법을 아직 시도하지 않았으며, 나중에 직접 테스트한 후에 본 편을 완성하는 방법을 제공합니다.여기서 공유하고 필요하면 직접 시도해 보세요.

좋은 웹페이지 즐겨찾기