본문 바로가기

기타

텐서플로 리눅스 환경 라즈베리파이 환경 설치(TensorFlow Install)

반응형

딥 러닝 알고리즘 중 구글에서 나온 텐서플로라는 것이 있다. 


홈페이지에 들어가 보면 구글, 페이스북, 트위터, 드롭박스, 우버 등 다양한 곳에서 사용 된다고 한다. 

텐서플로 홈페이지 : https://www.tensorflow.org/


홈페이지에서 설치 방법을 찾아보면 아래와 같이 pip을 이용한 설치 방법이 나온다.


우선 pip을 설치한다.

# Ubuntu/Linux 64-bit
$ sudo apt
-get install python-pip python-dev

# Mac OS X
$ sudo easy_install pip
$ sudo easy_install
--upgrade six


2. 텐서플로는 Pypi에 바이러니 파일이 올라가 있어 아래와 같이 CPU만 사용할 것인지 GPU도 함께 사용할 것인지 선택하여 설치하면 된다.

  - CPU만을 이용하는 텐서플로

$ pip install tensorflow

  - GPU를 이용하는 텐서플로

$ pip install tensorflow-gpu


만약 명령어가 실행이 안된다면 

이래 중 원하는 버전을 선택한 뒤 설치해 주면 된다.

  - 바이너리 파일

# Ubuntu/Linux 64-bit, CPU only, Python 2.7
$
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 2.7
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
$
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.1-cp27-none-linux_x86_64.whl

# Mac OS X, CPU only, Python 2.7:
$
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py2-none-any.whl

# Mac OS X, GPU enabled, Python 2.7:
$
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.1-py2-none-any.whl

# Ubuntu/Linux 64-bit, CPU only, Python 3.4
$
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp34-cp34m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.4
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
$
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.1-cp34-cp34m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, CPU only, Python 3.5
$
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp35-cp35m-linux_x86_64.whl

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Installing from sources" below.
$
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.1-cp35-cp35m-linux_x86_64.whl

# Mac OS X, CPU only, Python 3.4 or 3.5:
$
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.1-py3-none-any.whl

# Mac OS X, GPU enabled, Python 3.4 or 3.5:
$
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/gpu/tensorflow_gpu-0.12.1-py3-none-any.whl

  - 설치

# Python 2
$ sudo pip install
--upgrade $TF_BINARY_URL

# Python 3
$ sudo pip3 install
--upgrade $TF_BINARY_URL

* 홈페이지에서 윈도우, 가상환경에서 설치하는 방법도 나오니 윈도우나 가상 환경에서 사용할 사람은 홈페이지를 참고하면 될 것 같다.


지금까지 텐서플로를 설치하는 방법을 알아보았지만, 라지베리 파이는 우분투나 맥OS가 아닌 라즈비안을 사용하기에 조금 다른 방법이 필요하다.


텐서플로 GitHub: https://github.com/samjabrahams/tensorflow-on-raspberry-pi


라즈베리파이에서는 아래와 같은 방법으로 설치를 해야하는 것이다.

# For Python 2.7
$ wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v0.11.0/tensorflow-0.11.0-cp27-none-linux_armv7l.whl
$ sudo pip install tensorflow-0.11.0-cp27-none-linux_armv7l.whl

# For Python 3.3+
$ wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v0.11.0/tensorflow-0.11.0-py3-none-any.whl
$ sudo pip3 install tensorflow-0.11.0-py3-none-any.whl



텐서플로 공부 계획이 작심 3일로 끝나지 않았으면 좋겠다...

반응형