데이터 과학

케라스 설치 방법 본문

인공지능/파이썬 인공지능 - 딥러닝

케라스 설치 방법

티에스윤 2021. 9. 6. 14:44

딥러닝 프로그래밍 이전에 설치해야 할 텐서플로우, 케라스 설치 방법입니다.

 

먼저 해야 할일은 Anaconda를 다운로드 이후 설치하는 방법입니다. 

 

아나콘다 설치를 위해서는 다음 사이트에 가서 운영체제에 맞는 파일을 찾아서 설치하면 됩니다. 

 

https://www.anaconda.com/products/individual-d#download-section

 

Anaconda | Individual Edition

Anaconda's open-source Individual Edition is the easiest way to perform Python/R data science and machine learning on a single machine.

www.anaconda.com

 

다운로드는 운영체제 환경에 맞는 것을 선택하세요. 

 

 

 

 

설치 방법은 어렵지 않습니다. 

 

Close Anaconda Navigator and launch Anaconda Prompt. Launch Anaconda prompt by searching for it in the windows search bar. The following terminal should open. Notice that this will open on the base Anaconda environment.

 

conda install python=3.7.3

 

 

 

Downgrade Python to a Keras & Tensorflow compatible version. Anaconda will start to look for all the compatible modules for Python 3.6. This might take a few minutes. To downgrade to Python 3.6 use the following command:

 

 

TensorFlow

모두를 위한 엔드 투 엔드 오픈소스 머신러닝 플랫폼입니다. 도구, 라이브러리, 커뮤니티 리소스로 구성된 TensorFlow의 유연한 생태계를 만나 보세요.

www.tensorflow.org

 

파이썬 기능이 확장되는 라이브러리들이 있는데 현재는 텐서플로우와 케라스의 통합이 이루어졌습니다.

 

https://tykimos.github.io/2017/02/22/Integrating_Keras_and_TensorFlow/

 

케라스와 텐서플로우와의 통합

지난 주에 개최된 TensorFlow DEV SUMMIT 2017 행사에서 프랑소와 쏠레(François Chollet)님이 케라스(Keras)와 텐서플로우(TensorFlow)와의 통합이란 주제로 발표를 했습니다. 발표에서 이번 통합이 케라스 사용

tykimos.github.io

 

 

케라스를 설치해서 텐서플로우를 사용하는 방법이 쉽습니다. 

 

 

설치방법은 다음과 같습니다.

conda create --name keras python=3.7.3  
conda activate keras

 

--name은 새롭게 만드려고하는 폴더 이름입니다. keras라고 해도 되고 다른 이름을 써 넣어도 됩니다. 

파이썬 버전이 python=3.7.3이 아니면 python=3.8 일수도 있습니다. 다운 받은 아나콘다에 파이썬 버전이 있습니다.

 

c:\\keras\conda install -c anaconda keras

 

 

새로운 폴더에 keras를 다운받으세요. 

 

 

conda install spyder   # 스파이더를 실행해도 되고, 
conda install jupyter notebook   # 주피터를 실행해도 됩니다. 

 

 

 

 

스파이더나 주피터 노트북에서 

 

import tensorflow as tf

 

를 입력했을 때 에러메시지가 없으면 성공적으로 설치된 것입니다. 

 

 

 

아래링크는 케라스와 텐서플로우에 대한 이야기입니다. 한번 읽어보세요. 

 

https://www.itworld.co.kr/news/116583

 

떠오르는 심층 신경망 API,

심층 신경망(deep neural networks)이 유행이라고 하지만 주요 프레임워크의 복잡성으로 인해 머신러닝을 처음 접하는 개발자는 심층 신경망을 다루기가 어려운 실정이다. 그동안 신경망 모델을 구축

www.itworld.co.kr

 

 

 

아래 링크는 위에 설명된 원문입니다. 

https://towardsdatascience.com/installing-keras-tensorflow-using-anaconda-for-machine-learning-44ab28ff39cb

 

Installing Keras & Tensorflow using Anaconda for Machine Learning

This series will teach you how to explore and built models using python.

towardsdatascience.com

 

 

 

설치할 때 주의할 점이 있습니다. 

Tensorflow 2.0은 파이썬 3.9.0 이하에서만 지원이 됩니다. (3.9.0 이상에서는 지원이 안됩니다.)

 

아나콘다 최신버전이 파이썬 3.9.7이후로 지원되기 때문에 텐서플로우 설치하면 지원이 되지 않습니다. 

이럴 경우 이전 버전의 아나콘다를 다운로드 받거나 파이썬 웹사이트에 가서 3.8.0 이하 버전을 설치해서 환경변수를 변경하면 됩니다. 

 

아나콘다 올드버전 모아 놓은 링크는 다음과 같습니다. 

 

https://repo.anaconda.com/archive/

 

Index of /

last-invalidated 25 2022-09-16 09:11:50 907d63db3648b095468227c9a33b5ec93e4656b33ea80838c35b256a67600ecb

repo.anaconda.com

 

파이썬 3.7.4 버전이 있는 곳은 다음  링크에 있습니다.

 

 

https://www.python.org/downloads/release/python-374/

 

Python Release Python 3.7.4

The official home of the Python Programming Language

www.python.org