Developer
Installing tensorflow on MAC
rocksea
2018. 1. 15. 00:20
MAC에서 Tensorflow 설치하기.
Machine Learning과 Deep Learning을 공부하기 위해 Google에서 만든 오픈소스 프레임워크인 Tensorflow를 활용하여 다양한 학습모델을 구현하고 실행하기 위한 기본적인 환경을 구성해보자 한다. Docker를 이용하면 좀 더 편하게 설치가 가능하지만, 바로 MAC에서 실행하기 위한
환경을 만들어보았다.
* python 2.7기준으로 설치하였다.
1. virualenv 환경 만들기
각 프로젝트별 독립적인 개발환경을 제공하는 virtualenv를 설치한다.
$ sudo easy_install pip
$ pip install --upgrade virtualenv
$ virtualenv --system-site-packages tensorflow
2. tensorflow 설치
$ source ~/tensorflow/bin/activate
$ (tensorflow) easy_install -U pip
$ (tensorflow) pip install --upgrade tensorflow
tensorflow설치 명령이 실패하였을 경우.
$ (tensorflow) pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.4.1-py2-none-any.whl
3. 시각화 패키지 matplot 설치
$ python -m pip install -U pip setuptools
$ python -m pip install matplotlib
설치 시 아래의 오류 발생할 경우
RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are Working with Matplotlib in a virtual enviroment see 'Working with Matplotlib in Virtual environments' in the Matplotlib FAQ
~/.matplotlib/matplotlibrc 파일 생성 후 아래 라인을 추가 후 저장해준다.
backend: TkAgg