次のパスに python3.5 がないのはなぜですか? 自作を使用してPython3用のOpenCV3をインストールしました。このための完全な自作の要点は、こちらで見つけることができます。
このチュートリアルによると、次の手順に従ってください(チュートリアルが書かれている言語がわかりません): http://qiita.com/HirofumiYashima/items/eb697b1e359586b538e6
ls /usr/local/Cellar/opencv3/3.1.0_3/lib/python2.7/site-packages/cv2.so
私は次のことを期待しています:
ls /usr/local/Cellar/opencv3/3.1.0_3/lib/python3.5/site-packages/cv2.cpython-35m-darwin.so
どんな洞察も非常に役立ちます!
bash-4.3$ python
Python 3.5.2 (default, Jul 28 2016, 21:28:07)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
と
bash-4.3$ brew info opencv3 | grep python3
Built from source on 2016-07-30 at 22:49:10 with: --with-python3 --with-contrib
--with-python3
Build with python3 support
bash-4.3$ brew install opencv3 --with-python3
Warning: homebrew/science/opencv3-3.1.0_3 already installed
bash-4.3$ brew install opencv3
Warning: homebrew/science/opencv3-3.1.0_3 already installed
bash-4.3$ pyenv versions
* system (set by /Users/mona/.pyenv/cache/.python-version)
3.5.0
3.5.2
ちょっとした追加情報:
bash-4.3$ uname -a
Darwin Monas-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
どうもありがとう!
私のbash_profile:
~/.bash_profile
1 export PATH=$PATH:/usr/local/go/bin
2
3 [[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
4
5 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
6
7 # Setting PATH for Python 3.4
8 # The orginal version is saved in .bash_profile.pysave
9 PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
10 export PATH
11
12 # added by Anaconda2 2.4.1 installer
13 export PATH="/Users/mona/anaconda/bin:$PATH"
14
15 compresspdf() {
16 gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -dPDFSETTINGS=/${3:-"screen"} -dCompatibilityLevel=1.4 -sOutputFile=$2 $1
17 }
18
19
20 export PATH="/usr/local/sbin:$PATH"
21 export PATH=/usr/local/bin:$PATH
22 export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
23 source /usr/local/bin/virtualenvwrapper.sh
24 export PYENV_ROOT="$HOME/.pyenv"
25 export PATH="$PYENV_ROOT/bin:$PATH"
26 export PATH="~/.pyenv/bin:$PATH"
27 eval "$(pyenv init -)"
28 eval "$(pyenv virtualenv-init -)"
更新: opencv3 をインストールし、python3 で再度インストールしました。ただし、インストールされているライブラリには Python2.7 のみが表示されます。
bash-4.3$ brew install opencv3 --with-python3
==> Installing opencv3 from homebrew/science
==> Downloading https://github.com/Itseez/opencv/archive/3.1.0.tar.gz
==> Downloading from https://codeload.github.com/opencv/opencv/tar.gz/3.1.0
######################################################################## 100.0%
==> Downloading https://github.com/Itseez/opencv/commit/a2bda999211e8be9fbc5d40038fdfc9399de31fc.diff
==> Downloading from https://github.com/opencv/opencv/commit/a2bda999211e8be9fbc5d40038fdfc9399de31fc.diff
######################################################################## 100.0%
==> Downloading https://github.com/Itseez/opencv/commit/c7bdbef5042dadfe032dfb5d80f9b90bec830371.diff
==> Downloading from https://github.com/opencv/opencv/commit/c7bdbef5042dadfe032dfb5d80f9b90bec830371.diff
######################################################################## 100.0%
==> Downloading https://github.com/Itseez/opencv/commit/cdb9c60dcb65e04e7c0bd6bef9b86841191c785a.diff
==> Downloading from https://github.com/opencv/opencv/commit/cdb9c60dcb65e04e7c0bd6bef9b86841191c785a.diff
######################################################################## 100.0%
==> Patching
==> Applying a2bda999211e8be9fbc5d40038fdfc9399de31fc.diff
patching file modules/videoio/src/cap_qtkit.mm
==> Applying c7bdbef5042dadfe032dfb5d80f9b90bec830371.diff
patching file modules/core/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl.hpp
Hunk #1 succeeded at 45 (offset 4 lines).
Hunk #2 succeeded at 58 (offset 4 lines).
patching file modules/core/include/opencv2/core/opencl/runtime/autogenerated/opencl_gl_wrappers.hpp
patching file modules/core/src/opencl/runtime/autogenerated/opencl_gl_impl.hpp
patching file modules/core/src/opencl/runtime/generator/common.py
patching file modules/core/src/opencl/runtime/generator/template/opencl_gl.hpp.in
Hunk #1 succeeded at 12 (offset 4 lines).
patching file modules/core/src/opencl/runtime/generator/template/opencl_gl_impl.hpp.in
patching file modules/core/src/opencl/runtime/generator/template/opencl_gl_wrappers.hpp.in
patching file modules/core/src/opencl/runtime/opencl_core.cpp
Hunk #1 succeeded at 283 (offset -3 lines).
Hunk #2 succeeded at 305 (offset -3 lines).
patching file modules/core/src/opengl.cpp
==> Applying cdb9c60dcb65e04e7c0bd6bef9b86841191c785a.diff
patching file samples/gpu/CMakeLists.txt
==> Downloading https://raw.githubusercontent.com/Itseez/opencv_3rdparty/81a676001ca8075ada498583e4166079e5744668/ippicv/ippicv_macosx_20151201.tgz
######################################################################## 100.0%
==> cmake .. -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/opencv3/3.1.0_3 -DCMAKE_BUILD_TYPE=Release -D
==> make
==> make install
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
opencv3 and opencv install many of the same files.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/opencv3/lib
CPPFLAGS: -I/usr/local/opt/opencv3/include
If you need Python to find bindings for this keg-only formula, run:
echo /usr/local/opt/opencv3/lib/python2.7/site-packages >> /usr/local/lib/python2.7/site-packages/opencv3.pth
==> Summary
/usr/local/Cellar/opencv3/3.1.0_3: 281 files, 119M, built in 6 minutes 12 seconds
そして、私が持っています:
bash-4.3$ ls /usr/local/Cellar/opencv3/3.1.0_3/lib/
libopencv_calib3d.3.1.0.dylib libopencv_highgui.3.1.dylib libopencv_objdetect.dylib libopencv_video.3.1.0.dylib
libopencv_calib3d.3.1.dylib libopencv_highgui.dylib libopencv_photo.3.1.0.dylib libopencv_video.3.1.dylib
libopencv_calib3d.dylib libopencv_imgcodecs.3.1.0.dylib libopencv_photo.3.1.dylib libopencv_video.dylib
libopencv_core.3.1.0.dylib libopencv_imgcodecs.3.1.dylib libopencv_photo.dylib libopencv_videoio.3.1.0.dylib
libopencv_core.3.1.dylib libopencv_imgcodecs.dylib libopencv_shape.3.1.0.dylib libopencv_videoio.3.1.dylib
libopencv_core.dylib libopencv_imgproc.3.1.0.dylib libopencv_shape.3.1.dylib libopencv_videoio.dylib
libopencv_features2d.3.1.0.dylib libopencv_imgproc.3.1.dylib libopencv_shape.dylib libopencv_videostab.3.1.0.dylib
libopencv_features2d.3.1.dylib libopencv_imgproc.dylib libopencv_stitching.3.1.0.dylib libopencv_videostab.3.1.dylib
libopencv_features2d.dylib libopencv_ml.3.1.0.dylib libopencv_stitching.3.1.dylib libopencv_videostab.dylib
libopencv_flann.3.1.0.dylib libopencv_ml.3.1.dylib libopencv_stitching.dylib pkgconfig
libopencv_flann.3.1.dylib libopencv_ml.dylib libopencv_superres.3.1.0.dylib python2.7
libopencv_flann.dylib libopencv_objdetect.3.1.0.dylib libopencv_superres.3.1.dylib
libopencv_highgui.3.1.0.dylib libopencv_objdetect.3.1.dylib libopencv_superres.dylib
opencv3 に関する brew info の内容は次のとおりです。
bash-4.3$ brew info opencv3
homebrew/science/opencv3: stable 3.1.0 (bottled), HEAD [keg-only]
Open source computer vision library, version 3
http://opencv.org/
/usr/local/Cellar/opencv3/3.1.0_3 (281 files, 119M)
Built from source on 2016-08-02 at 18:54:26 with: --with-python3
From: https://github.com/Homebrew/homebrew-science/blob/master/opencv3.rb
==> Dependencies
Build: cmake ✔, pkg-config ✔
Required: jpeg ✔, libpng ✔, libtiff ✔
Recommended: eigen ✔, openexr ✔, homebrew/python/numpy ✔
Optional: ffmpeg ✔, gphoto2 ✘, gstreamer ✘, jasper ✘, libdc1394 ✘, openni ✘, openni2 ✘, qt ✔, qt5 ✘, tbb ✔, vtk ✔
==> Options
--32-bit
Build 32-bit only
--c++11
Build using C++11 mode
--with-contrib
Build "extra" contributed modules
--with-cuda
Build with CUDA v7.0+ support
--with-examples
Install C and python examples (sources)
--with-ffmpeg
Build with ffmpeg support
--with-gphoto2
Build with gphoto2 support
--with-gstreamer
Build with gstreamer support
--with-jasper
Build with jasper support
--with-java
Build with Java support
--with-libdc1394
Build with libdc1394 support
--with-opengl
Build with OpenGL support (must use --with-qt5)
--with-openni
Build with openni support
--with-openni2
Build with openni2 support
--with-python3
Build with python3 support
--with-qt
Build the Qt4 backend to HighGUI
--with-qt5
Build the Qt5 backend to HighGUI
--with-quicktime
Use QuickTime for Video I/O instead of QTKit
--with-static
Build static libraries
--with-tbb
Enable parallel code in OpenCV using Intel TBB
--with-vtk
Build with vtk support
--without-eigen
Build without eigen support
--without-numpy
Use a numpy you've installed yourself instead of a Homebrew-packaged numpy
--without-opencl
Disable GPU code in OpenCV using OpenCL
--without-openexr
Build without openexr support
--without-python
Build without Python support
--without-test
Build without accuracy & performance tests
--HEAD
Install HEAD version
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
opencv3 and opencv install many of the same files.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/opencv3/lib
CPPFLAGS: -I/usr/local/opt/opencv3/include