配置笔记

OpenCV

很简单,使用 Homebrew 安装:

1
2
brew tap homebrew/science
brew install opencv

如果使用的是 Anaconda 的 Python,则需要修改 opencv 中的 python 路径。执行 brew edit opencv,修改如下两行:

1
2
-DPYTHON_LIBRARY=#{py_prefix}/lib/libpython2.7.dylib
-DPYTHON_INCLUDE_DIR=#{py_prefix}/include/python2.7

注意 brew edit 默认使用的是 vim,你可以配置环境变量(如 ~/.bash_profile 文件)加上 EDITOR 变量指定 brew 使用的编辑器,如 export EDITOR=atom

Torch

在命令行下执行:

1
2
3
curl -s https://raw.githubusercontent.com/torch/ezinstall/master/install-deps | bash
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; ./install.sh