Skip to content

Instantly share code, notes, and snippets.

@shinob
Last active November 27, 2019 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shinob/8a6c8827470833bf4a76a37f24cf821d to your computer and use it in GitHub Desktop.
Save shinob/8a6c8827470833bf4a76a37f24cf821d to your computer and use it in GitHub Desktop.
Macで深層学習の環境をさくっと作る手順 with TensorFlow and OpenCV ref: https://qiita.com/mix_dvd/items/b49651cf1181a986506c
cd ~/Downloads
curl -LO https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
tar xf pkg-config-0.29.2.tar.gz
cd pkg-config-0.29.2
./configure --with-internal-glib
make && make install
cd ~/Downloads
curl -LO http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make && make install
cd ~/Downloads
curl -LO http://www.ffmpegmac.net/resources/ffmpeg-3.3.1.tar.bz2
tar xf ffmpeg-3.3.1.tar.bz2
cd ffmpeg-3.3.1
./configure
make && make install
cd ~/Downloads
curl -LO https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz
tar xf pkg-config-0.29.2.tar.gz
cd pkg-config-0.29.2
./configure --with-internal-glib
make && make install
cd ~/Downloads
curl -LO http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make && make install
cd ~/Downloads
curl -LO http://www.ffmpegmac.net/resources/ffmpeg-3.3.1.tar.bz2
tar xf ffmpeg-3.3.1.tar.bz2
cd ffmpeg-3.3.1
./configure
make && make install
conda install py-xgboost
$ python
Python 3.6.0 |Anaconda 4.3.1 (x86_64)| (default, Dec 23 2016, 13:19:00)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> import tensorflow as tf
>>> exit()
$
c.NotebookApp.browser = u'/usr/bin/open -a Safari %s'
$ sudo sh tools_installer.sh
$ sudo sh tools_installer.sh
$ sudo sh ffmpeg_installer.sh
$ sudo sh ffmpeg_installer.sh
$ sudo sh opencv_installer.sh
$ sudo sh opencv_installer.sh
$ pip install tensorflow
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export RBENV_ROOT="$HOME/.rbenv"' >> ~/.bashrc
echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
rbenv install 2.4.1
rbenv rehash
rbenv global 2.4.1
gem install rbczmq
gem install iruby
gem install erector
iruby notebook
cd ~/Downloads
unzip IPAfont00303.zip
mv IPAfont00303/*.ttf ~/.pyenv/versions/anaconda3-4.3.1/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf/
jupyter notebook --generate-config
echo "c.NotebookApp.notebook_dir = u'notebook'" >> ~/.jupyter/jupyter_notebook_config.py
cd ~/Downloads
git clone https://github.com/Itseez/opencv.git opencv
git clone https://github.com/Itseez/opencv_contrib.git opencv_contrib
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D BUILD_SHARED_LIBS=OFF \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D FFMPEG=ON \
-D PYTHON3_EXECUTABLE=/Users/[username]/.pyenv/versions/anaconda3-4.3.1/bin/python \
-D PYTHON3_INCLUDE_DIR=/Users/[username]/.pyenv/versions/anaconda3-4.3.1/include/python3.6m \
-D PYTHON3_LIBRARY=/Users/[username]/.pyenv/versions/anaconda3-4.3.1/lib/libpython3.6m.dylib \
-D PYTHON3_NUMPY_INCLUDE_DIRS=/Users/[username]/.pyenv/versions/anaconda3-4.3.1/lib/python3.6/site-packages/numpy/core/include \
-D PYTHON3_PACKAGES_PATH=/Users/[username]/.pyenv/versions/anaconda3-4.3.1/lib/python3.6/site-packages \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D BUILD_EXAMPLES=ON \
-D BUILD_opencv_python3=ON \
-D OPENCV_EXTRA_MODULES_PATH=~/Downloads/opencv_contrib/modules \
..
make -j4
make install
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
echo 'if [ -f ~/.bashrc ] ; then' >> ~/.bash_profile
echo '. ~/.bashrc' >> ~/.bash_profile
echo 'fi' >> ~/.bash_profile
source ~/.bashrc
pyenv install anaconda3-4.3.1
pyenv rehash
pyenv global anaconda3-4.3.1
echo 'export PATH="$PYENV_ROOT/versions/anaconda3-4.3.1/bin/:$PATH"' >> ~/.bashrc
source ~/.bashrc
cd ~/Downloads
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
tar xzf autoconf-latest.tar.gz
cd autoconf-*
./configure --prefix=/usr/local
make && sudo make install
cd ~/Downloads
curl -fL http://ftpmirror.gnu.org/automake/automake-1.15.tar.gz | tar xzf -
cd automake-*
./configure --prefix=/usr/local
make && make install
cd ~/Downloads
curl -fL http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz | tar xzf -
cd libtool-*
./configure --prefix=/usr/local
make && make install
cd ~/Downloads
curl -OL https://cmake.org/files/v3.8/cmake-3.8.1-Darwin-x86_64.tar.gz
tar xzf cmake-3.8.1-Darwin-x86_64.tar.gz
cd came-*
cp CMake.app /Applications/
ln -s "/Applications/CMake.app/Contents/bin/ccmake" /usr/local/bin/ccmake
ln -s "/Applications/CMake.app/Contents/bin/cmake" /usr/local/bin/cmake
ln -s "/Applications/CMake.app/Contents/bin/cmake-gui" /usr/local/bin/cmake-gui
ln -s "/Applications/CMake.app/Contents/bin/cmakexbuild" /usr/local/bin/cmakexbuild
ln -s "/Applications/CMake.app/Contents/bin/cpack" /usr/local/bin/cpack
ln -s "/Applications/CMake.app/Contents/bin/ctest" /usr/local/bin/ctest
cd ~/Downloads
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
tar xzf autoconf-latest.tar.gz
cd autoconf-*
./configure --prefix=/usr/local
make && sudo make install
cd ~/Downloads
curl -fL http://ftpmirror.gnu.org/automake/automake-1.15.tar.gz | tar xzf -
cd automake-*
./configure --prefix=/usr/local
make && sudo make install
cd ~/Downloads
curl -fL http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz | tar xzf -
cd libtool-*
./configure --prefix=/usr/local
make && sudo make install
cd ~/Downloads
curl -OL https://cmake.org/files/v3.8/cmake-3.8.1-Darwin-x86_64.tar.gz
tar xzf cmake-3.8.1-Darwin-x86_64.tar.gz
cd cmame-*
cp CMake.app /Applications/
ln -s "/Applications/CMake.app/Contents/bin/ccmake" /usr/local/bin/ccmake
ln -s "/Applications/CMake.app/Contents/bin/cmake" /usr/local/bin/cmake
ln -s "/Applications/CMake.app/Contents/bin/cmake-gui" /usr/local/bin/cmake-gui
ln -s "/Applications/CMake.app/Contents/bin/cmakexbuild" /usr/local/bin/cmakexbuild
ln -s "/Applications/CMake.app/Contents/bin/cpack" /usr/local/bin/cpack
ln -s "/Applications/CMake.app/Contents/bin/ctest" /usr/local/bin/ctest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment