Tensorflow를 설치하기 전에 알아두어야할 것이 있다.

 

글 작성 현재 2019-07-08 기준, Tensorflow를 설치하기 위해서는 3.6 버전 이하의 Python이 필요하고(최신버전인 Python3.7로 설치하면 안된다.) 그 Python이 64bit여야한다.

 

이 글에서는 Python3.6.2-64bit install 및 tensorflow 설치에 대해 다룬다.

 

 

 

1. Python 설치파일 다운로드

https://www.python.org/downloads/windows/

해당 사이트로 이동하여 Python 3.6.2 Windows x86-64 executable installer를 다운로드 받는다.

Download Windows x86-64 executable installer

편의를 위해 설치시 'PATH에 자동으로 추가하기' 항목 체크를 해줍니다.

 

 

 

2. 설치 확인

python -V 를 통해 설치된 파이썬 버전 확인 가능 -> Python 3.6.2

pip -V 를 통해 설치된 pip 버전 확인 가능 -> pip 19.1.1

 

 

 

3. Tensorflow 설치

pip install tensorflow

 

 

 

4. Tensorflow 정상 import 여부 확인

cmd에서

python

>>> import tensorflow

입력시 에러 문구 없이 정상적으로 import되면 정상 설치 완료 (아직 완료가 되지 않아 실패 로그 발생할 것임)

        비정상 상태 확인

ImportError: Could not find 'msvcp140.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. You may install this DLL by downloading Visual C++ 2015 Redistributable Update 3 from this URL: https://www.microsoft.com/en-us/download/details.aspx?id=53587

로 출력된 에러 문구에 따라 해당 링크로 이동하여 다운로드 및 실행 진행

https://www.microsoft.com/ko-KR/download/details.aspx?id=53587

설치 완료 후 다시

import tensorflow

진행하면 정상 확인 완료

 

 

 

5. 간단한 tensorflow 활용 파일 만들어 실행하기

first_test.py

========================================

import tensorflow as tf
hello = tf.constant('Hello World!!!')
sess = tf.compat.v1.Session()
print(sess.run(hello))

========================================

 ` Hello World!!! ` 가 정상적으로 출력됨을 확인할 수 있다.

만약 텐서플로우를 실행하는 과정에서 위와 비슷한 내용은 Error나 Warning이 아닌 Info성 메세지이다.

 

관련 내용과 해결 방법은 아래 페이지를 참조하여 진행하자.

https://growingsaja.tistory.com/142

 

 

+ Recent posts