MacOS+miniconda+theano安装(tensorflow)
-
brew update --debug --verbose
- brew install wget
-
xcode-select --install
- 以上都不行
Error: No such file or directory @ dir_chdir - /usr/local/Cellar
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
这样,在最新的HomeBrew
中,安装的时候就将需要的目录都已经创建完成并且分配了所需的权限,那么在用brew
去安装其他软件的时候就可以不需要sudo
权限直接进行了 -
替换核心软件仓库
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
替换 cask 软件仓库(提供 macOS 应用和大型二进制文件)cd "$(brew --repo)"/Library/Taps/caskroom/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
替换 Bottles 源(Homebrew 预编译二进制软件包)bash(默认 shell)用户:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile - brew install wget
- https://docs.conda.io/en/latest/miniconda.html找到合适版本; cd ~
-
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
- bash Miniconda3-latest-MacOSX-x86_64.sh
Miniconda3 will now be installed into this location: -
/Users/jingyuli/miniconda3.
- 手动加载环境变量来使得conda生效. source ~/.bash_profile
- conda -h. 检验安装成功
接下来theano
- conda create -n theano python=3.5
- conda-env list
- source activate theano
Install requirements and optional packages
- conda install numpy scipy mkl nose sphinx
- pip install parameterized
Install and configure the GPU drivers (recommended) CUDA安装
macbookpro没有英伟达显卡 不支持gpu
- conda install theano pygpu (CondaHTTPError)
-
git clone https://github.com/Theano/libgpuarray.git
cd libgpuarray
git checkout tags/v0.6.5 -b v0.6.9 -
conda install pygpu
-
brew install cmake
-
mkdir Build
cd Build
# you can pass -DCMAKE_INSTALL_PREFIX=/path/to/somewhere to install to an alternate location
cmake .. -DCMAKE_BUILD_TYPE=Release # or Debug if you are investigating a crash
make
make install
cd .. - pip install Theano
- conda install mkl-service
- test:
ERROR: Failure: ImportError (No module named 'parameterized')
- pip install nose-parameterized
tensorboard的使用
import tensorflow as tf from tensorboard import summary with tf.name_scope('input1'): input1=tf.constant([1.0,2.0,3.0],name="input1") with tf.name_scope('input2'): input2=tf.Variable(tf.random_uniform([3]),name="input2") output=tf.add_n([input1,input2],name="add") writer=tf.summary.FileWriter(r"./summary",tf.get_default_graph()) writer.close()
source activate tf
python /Users/jingyuli/miniconda3/envs/tf/bin/tensorboard --logdir /Users/jingyuli/PycharmProjects/tf-session/summary
报错
ModuleNotFoundError: No module named 'tensorboard'
是因为没有source activate tf
http://localhost:6006/
安装tf2
- conda create -n tf2 python=3.7
- conda-env list
- source activate tf2
安装pytorch
- conda create -n pytorch python=3.6.5
- conda-env list
- source activate pytorch
conda install pytorch torchvision -c pytorch