我正在尝试使用Anaconda和Python 3.6.2在Ubuntu 17.10上安装OpenCV for Python
我目前致电CMake:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.1.0/modules \
-D PYTHON_EXECUTABLE=~/anaconda3/bin/python \
-D PYTHON_INCLUDE_DIR=~/anaconda3/include \
-D PYTHON_LIBRARY=~/anaconda3/lib \
-D BUILD_EXAMPLES=ON ..\
不幸的是,这给出了错误:
-- Could NOT find PythonLibs: Found unsuitable version "3.6.3", but required is exact version "3.6.2" (found /usr/lib/x86_64-linux-gnu/libpython3.6m.so)
有谁知道如何解决这个问题?
编辑:
My Anaconda环境包含以下软件包:
ca-certificates 2017.08.26 h1d4fec5_0
certifi 2017.7.27.1 py36h8b7b77e_0
libedit 3.1 heed3624_0
libffi 3.2.1 hd88cf55_4
libgcc-ng 7.2.0 h7cc24e2_2
libstdcxx-ng 7.2.0 h7a57d05_2
ncurses 6.0 h9df7e31_2
openssl 1.0.2m h8cfc7e7_0
pip 9.0.1 py36h6c6f9ce_4
python 3.6.2 hca45abc_19
readline 7.0 ha6073c6_4
setuptools 36.5.0 py36he42e2e1_0
sqlite 3.20.1 hb898158_2
tk 8.6.7 hc745277_3
wheel 0.29.0 py36he7f4e38_1
xz 5.2.3 h55aa19d_2
zlib 1.2.11 ha838bed_2
编辑2:
只是为了添加一些信息,尝试访问核心OpenCV函数似乎工作正常,它的唯一功能是OpenCV_Contrib的一部分似乎无法安装。
python -v
的输出import _frozen_importlib # frozen
import _imp # builtin
import sys # builtin
import '_warnings' # <class '_frozen_importlib.BuiltinImporter'>
import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
import '_frozen_importlib_external' # <class '_frozen_importlib.FrozenImporter'>
import '_io' # <class '_frozen_importlib.BuiltinImporter'>
import 'marshal' # <class '_frozen_importlib.BuiltinImporter'>
import 'posix' # <class '_frozen_importlib.BuiltinImporter'>
import _thread # previously loaded ('_thread')
import '_thread' # <class '_frozen_importlib.BuiltinImporter'>
import _weakref # previously loaded ('_weakref')
import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>
# installing zipimport hook
import 'zipimport' # <class '_frozen_importlib.BuiltinImporter'>
# installed zipimport hook
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/encodings/__pycache__/__init__.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/encodings/__init__.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/encodings/__pycache__/__init__.cpython-36.pyc'
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/codecs.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/codecs.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/codecs.cpython-36.pyc'
import '_codecs' # <class '_frozen_importlib.BuiltinImporter'>
import 'codecs' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb07837fd0>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/encodings/__pycache__/aliases.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/encodings/aliases.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/encodings/__pycache__/aliases.cpython-36.pyc'
import 'encodings.aliases' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb077cf9b0>
import 'encodings' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb07837b38>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/encodings/__pycache__/utf_8.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/encodings/utf_8.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/encodings/__pycache__/utf_8.cpython-36.pyc'
import 'encodings.utf_8' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb077dc7b8>
import '_signal' # <class '_frozen_importlib.BuiltinImporter'>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/encodings/__pycache__/latin_1.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/encodings/latin_1.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/encodings/__pycache__/latin_1.cpython-36.pyc'
import 'encodings.latin_1' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb077e02e8>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/io.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/io.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/io.cpython-36.pyc'
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/abc.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/abc.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/abc.cpython-36.pyc'
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/_weakrefset.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/_weakrefset.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/_weakrefset.cpython-36.pyc'
import '_weakrefset' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb077e7240>
import 'abc' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb077e08d0>
import 'io' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb077e0518>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/site.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/site.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/site.cpython-36.pyc'
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/os.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/os.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/os.cpython-36.pyc'
import 'errno' # <class '_frozen_importlib.BuiltinImporter'>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/stat.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/stat.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/stat.cpython-36.pyc'
import '_stat' # <class '_frozen_importlib.BuiltinImporter'>
import 'stat' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0778a518>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/posixpath.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/posixpath.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/posixpath.cpython-36.pyc'
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/genericpath.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/genericpath.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/genericpath.cpython-36.pyc'
import 'genericpath' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0778cef0>
import 'posixpath' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0778abe0>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/_collections_abc.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/_collections_abc.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/_collections_abc.cpython-36.pyc'
import '_collections_abc' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb07796550>
import 'os' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb07779e48>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/_sitebuiltins.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/_sitebuiltins.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/_sitebuiltins.cpython-36.pyc'
import '_sitebuiltins' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0777c278>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/sysconfig.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/sysconfig.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/sysconfig.cpython-36.pyc'
import 'sysconfig' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0774a9b0>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/_sysconfigdata_m_linux_x86_64-linux-gnu.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/_sysconfigdata_m_linux_x86_64-linux-gnu.cpython-36.pyc'
import '_sysconfigdata_m_linux_x86_64-linux-gnu' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0775e198>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/_bootlocale.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/_bootlocale.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/_bootlocale.cpython-36.pyc'
import '_locale' # <class '_frozen_importlib.BuiltinImporter'>
import '_bootlocale' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0776d198>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/types.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/types.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/types.cpython-36.pyc'
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/functools.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/functools.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/functools.cpython-36.pyc'
import '_functools' # <class '_frozen_importlib.BuiltinImporter'>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/collections/__pycache__/__init__.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/collections/__init__.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/collections/__pycache__/__init__.cpython-36.pyc'
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/operator.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/operator.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/operator.cpython-36.pyc'
import '_operator' # <class '_frozen_importlib.BuiltinImporter'>
import 'operator' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0646e048>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/keyword.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/keyword.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/keyword.cpython-36.pyc'
import 'keyword' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0647a2b0>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/heapq.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/heapq.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/heapq.cpython-36.pyc'
# extension module '_heapq' loaded from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/lib-dynload/_heapq.cpython-36m-x86_64-linux-gnu.so'
# extension module '_heapq' executed from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/lib-dynload/_heapq.cpython-36m-x86_64-linux-gnu.so'
import '_heapq' # <_frozen_importlib_external.ExtensionFileLoader object at 0x7fbb0647afd0>
import 'heapq' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0647aac8>
import 'itertools' # <class '_frozen_importlib.BuiltinImporter'>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/reprlib.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/reprlib.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/reprlib.cpython-36.pyc'
import 'reprlib' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb06472780>
import '_collections' # <class '_frozen_importlib.BuiltinImporter'>
import 'collections' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0644d710>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/weakref.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/weakref.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/weakref.cpython-36.pyc'
import 'weakref' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0644db00>
import 'functools' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb06440eb8>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/collections/__pycache__/abc.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/collections/abc.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/collections/__pycache__/abc.cpython-36.pyc'
import 'collections.abc' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb06441b70>
import 'types' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb06440240>
import 'site' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb077eab70>
Python 3.6.2 |Anaconda, Inc.| (default, Oct 5 2017, 07:59:26)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
# extension module 'readline' loaded from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/lib-dynload/readline.cpython-36m-x86_64-linux-gnu.so'
# extension module 'readline' executed from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/lib-dynload/readline.cpython-36m-x86_64-linux-gnu.so'
import 'readline' # <_frozen_importlib_external.ExtensionFileLoader object at 0x7fbb0643aa90>
import 'atexit' # <class '_frozen_importlib.BuiltinImporter'>
# /home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/rlcompleter.cpython-36.pyc matches /home/violet/.conda/envs/visualunderstanding/lib/python3.6/rlcompleter.py
# code object from '/home/violet/.conda/envs/visualunderstanding/lib/python3.6/__pycache__/rlcompleter.cpython-36.pyc'
import 'rlcompleter' # <_frozen_importlib_external.SourceFileLoader object at 0x7fbb0643aba8>