RaspberryPiとUbuntu16.04にpipでtensorflowをインストールする
RaspberryPi3(Raspbian)とUbuntu16.04にtensorflowをインストールしていきます。
[python3系デフォルト設定]
*python2の人はここの作業は不要です。
すでに以下のpython3系のインストールをやっているとして
sudo apt-get install python3 python3-pip python3-dev python3-numpy python3-scipy python3-matplotlib
まず僕の環境はpython3なので、
python3をデフォルトに設定させました
sudo nano .bashrc
一番下に記入
alias python=python3
$ . ~/.bashrc $ python --version
確認できたらok
[tensorflowインストール]
次にネイティブpipでtensorflowをインストール
tensorflowでgpuとかpython2系3系があるので以下を参照
$ pip install tensorflow # Python 2.7; CPU support (no GPU support) $ pip3 install tensorflow # Python 3.n; CPU support (no GPU support) $ pip install tensorflow-gpu # Python 2.7; GPU support $ pip3 install tensorflow-gpu # Python 3.n; GPU support
もしできなかった場合は、.whlでインストール
下のコマンドの最後にある”tfBinaryURL”の部分を自分の環境に合うURLに置き換える。
Python 2.7の場合 $ sudo pip install --upgrade tfBinaryURL # Python 3系の場合 $ sudo pip3 install --upgrade tfBinaryURL
Python 2.7
CPU only:
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp27-none-linux_x86_64.whl
GPU support:
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.3.0-cp27-none-linux_x86_64.whl
Python 3.4
CPU only:
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp34-cp34m-linux_x86_64.whl
GPU support:
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.3.0-cp34-cp34m-linux_x86_64.whl
Python 3.5
CPU only:
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp35-cp35m-linux_x86_64.whl
GPU support:
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.3.0-cp35-cp35m-linux_x86_64.whl
Python 3.6
CPU only:
https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.3.0-cp36-cp36m-linux_x86_64.whl
GPU support:
https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.3.0-cp36-cp36m-linux_x86_64.whl
ちなみにtensorflowのアンインストールは
$ sudo pip uninstall tensorflow # for Python 2.7 $ sudo pip3 uninstall tensorflow # for Python 3.n
おわり