[๋จธ์ ๋ฌ๋] ํ์ด์ฌ(Python), ํ ์ํ๋ก์ฐ(Tensor Flow) ์ค์น
๋ณธ ํฌ์คํธ๋ Windows ํ๊ฒฝ์ ๋ฐํ์ผ๋ก ์์ฑ๋์์ต๋๋ค.
๊ถ๊ธํ ์ ์ ๋๊ธ๋ก ๋จ๊ฒจ์ฃผ์๋ฉด ์น์ ํ๊ฒ ์๋ ค๋๋ฆฌ๊ฒ ์ต๋๋ค ^^!
ํ์ด์ฌ 3 ์ค์น(Install Python3)
https://www.python.org/downloads/
ํ์ด์ฌ 3.6 ๋ฒ์ ์ ๋ค์ด๋ก๋ํ์ฌ ์ค์นํ๋ค.
ํ์ฌ ํ ์ํ๋ก์ฐ 1 ๋ฒ์ ๋๋ ๋ ํ์ด์ฌ 3.6๊น์ง ์ง์ํ๊ณ 2 ๋ฒ์ ๋๋ 3.7๋ฅผ ์ง์ํ์ง๋ง ์์ง ๋ฒ ํ ๋ฒ์ ์ด๋ค.
์์ ์ ์์คํ ์ด 64๋นํธ๋ผ๋ฉด ์๋ ๋งํฌ๋ฅผ ํตํด ๋ค์๊ณผ ๊ฐ์ ์ค์น ํ์ผ์ ๋ค์ด๋ก๋ํ์ฌ ์ค์น๋ฅผ ์งํํ๋ค.
https://www.python.org/downloads/windows/
์ค์น๋ ๋ณ ๋ค๋ฅธ ์ค๋ช ์์ด Next ๋๋ฌ ์งํํ๋ฉด ๋๋ค. ๋จ, ํ ์ํ๋ก์ฐ๋ pip๋ผ๋ ํจํค์ง ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ด๋ฆฌ ์์คํ ์ ํตํด ์ค์นํ ๊ฒ์ด๋ฏ๋ก ๊ผญ ์๋์ ๊ฐ์ด ์ฒดํฌํด์ฃผ์.
ํ ์ํ๋ก์ฐ ์ค์น(Install TensorFlow)
์๋์ฐ cmd์ฐฝ์ ์ผ์ ๋ค์๊ณผ ๊ฐ์ ๋ช ๋ น์ด๋ฅผ ์ ๋ ฅํ์.
pip install --upgrade tensorflow
์๋์ ๊ฐ์ ์๋ฌ ๋ฉ์์ง๊ฐ ์ถ๋ ฅ๋๋ฉด์ ์ค์น๊ฐ ์ ๋๋ ๊ฒฝ์ฐ๊ฐ ๋ฐ์ํ๊ธฐ๋ ํ๋๋ฐ
Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versi
ons: )
No matching distribution found for tensorflow
You are using pip version 19.0.3, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.
๋ค์ ๋ช ๋ น์ด๋ฅผ ํตํด ํด๊ฒฐ์ด ๊ฐ๋ฅํ๋ค.
python -m pip install --upgrade pip
Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55
aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB)
100% |โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 1.4MB 598kB/s
Installing collected packages: pip
Found existing installation: pip 19.0.3
Uninstalling pip-19.0.3:
Successfully uninstalled pip-19.0.3
Successfully installed pip-19.1.1
๊ทธ๋๋!! ๋ค์๊ณผ ๊ฐ์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ค๋ฉด?
Collecting tensorflow
ERROR: Could not find a version that satisfies the requirement tensorflow (fro
m versions: none)
ERROR: No matching distribution found for tensorflow
์์ ์ ์์คํ ์ด 64๋นํธ ์์คํ ์ธ๋ฐ 32๋นํธ ํ์ด์ฌ์ ์ค์นํด์ ์๋ฌ๊ฐ ์๊ธด ๊ฒ์ด๋ค.
์์ ํ์ด์ฌ ์ค์น ๊ณผ์ ์ ํตํด 64๋นํธ ํ์ด์ฌ 3์ ์ค์นํ์.
ํ ์ํ๋ก์ฐ ์๋ฌ ํด๊ฒฐ ๋ฐ ํ ์คํธ(TensorFlow Error & Test)
ํ ์ํ๋ก์ฐ๊ฐ ์ ์์ ์ผ๋ก ์ค์น๋์๋์ง ํ์ด์ฌ IDE๋ฅผ ์คํ์์ผ์ ๋ค์๊ณผ ๊ฐ์ ๋ช ๋ น์ด๋ฅผ ๋ ๋ ค๋ณด์
>>> import tensorflow as tf
๋ค์๊ณผ ๊ฐ์ ์๋ฌ ๋ฉ์์ง๋ค์ด ์ข๋ฅด๋ฅต ๋์ฌ ์๊ฐ ์๋ค ใ ก_ใ ก;;; ์ญ์ ์ค์น๊ฐ ์ํ์น ์๋ค.
Traceback (most recent call last):
File "E:\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "E:\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "E:\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "E:\Python37\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "E:\Python37\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed with error code -1073741795
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import tensorflow as tf
File "E:\Python37\lib\site-packages\tensorflow\__init__.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "E:\Python37\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "E:\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "E:\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "E:\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "E:\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "E:\Python37\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "E:\Python37\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed with error code -1073741795
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
ImportError: DLL load failed with error code -1073741795 ํด๊ฒฐ ๋ฐฉ๋ฒ
์ฌ๋ฌ ์ฝ์ง๊ณผ ๊ตฌ๊ธ๋ง์ ํด๋ณธ ๊ฒฐ๊ณผ, ์๋์ ๋ฐฉ๋ฒ์ ๋ชจ๋ ์๋ํด๋ณด๋ ํด๊ฒฐ๋์๋ค.
1. tensorflow 1.5 ๋ฒ์ ์ค์น
pip install --upgrade tensorflow ๋ช ๋ น์ด๋ฅผ ํตํด ์ค์น๋๋ ๋ฒ์ ์ 1.4 ๋ฒ์ ์ด๋ค.
์คํ์ค๋ฒํ๋ก์ฐ์ ๋ฒ์ ์ ๋์ฌ์ ์๋ํด๋ณด๋ผ๋ ๊ธ๋ค์ด ์์ด์ ์๋ํด๋ดค๋๋ ๋์ ๊ฒฝ์ฐ๋ ํด๊ฒฐ๋์๋ค.
# ๊ธฐ์กด ์ค์น๋ ํ
์ํ๋ก์ฐ ์ ๊ฑฐ
pip uninstall tensorflow
# 1.5 ์ค์น
pip install --upgrade tensorflow==1.5.0
2. Visual Studio 2015++ ์ฌ๋ฐฐํฌ ๊ฐ๋ฅ ํจํค์ง ์ ๋ฐ์ดํธ 3 ์ค์น
3. CUDA & cuDNN ์ค์น
https://developer.nvidia.com/cuda-10.0-download-archive
https://developer.nvidia.com/cudnn
Python IDLE์์ ๋ค์๊ณผ ๊ฐ์ ๋ช ๋ น์ด๊ฐ ์ ์์ ์ผ๋ก ์ํ๋๋ฉด ์ฑ๊ณต์ด๋ค.
>>> import tensorflow as tf
>>> tf.__version__
'1.5.0'
'Development > Machine Learning' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๋๊ธ
์ด ๊ธ ๊ณต์ ํ๊ธฐ
-
๊ตฌ๋
ํ๊ธฐ
๊ตฌ๋ ํ๊ธฐ
-
์นด์นด์คํก
์นด์นด์คํก
-
๋ผ์ธ
๋ผ์ธ
-
ํธ์ํฐ
ํธ์ํฐ
-
Facebook
Facebook
-
์นด์นด์ค์คํ ๋ฆฌ
์นด์นด์ค์คํ ๋ฆฌ
-
๋ฐด๋
๋ฐด๋
-
๋ค์ด๋ฒ ๋ธ๋ก๊ทธ
๋ค์ด๋ฒ ๋ธ๋ก๊ทธ
-
Pocket
Pocket
-
Evernote
Evernote
๋ค๋ฅธ ๊ธ
-
[๋จธ์ ๋ฌ๋ ์ ๋ฌธ] 02. TensorFlow๋ก Linear regression ๊ตฌํ
[๋จธ์ ๋ฌ๋ ์ ๋ฌธ] 02. TensorFlow๋ก Linear regression ๊ตฌํ
2019.07.04 -
[๋จธ์ ๋ฌ๋ ์ ๋ฌธ] 02. Linear Regression์ Hypothesis์ Cost
[๋จธ์ ๋ฌ๋ ์ ๋ฌธ] 02. Linear Regression์ Hypothesis์ Cost
2019.07.04 -
[๋จธ์ ๋ฌ๋ ์ ๋ฌธ] 01. TensorFlow์ ๊ธฐ๋ณธ์ ์ธ operations
[๋จธ์ ๋ฌ๋ ์ ๋ฌธ] 01. TensorFlow์ ๊ธฐ๋ณธ์ ์ธ operations
2019.07.01 -
[๋จธ์ ๋ฌ๋ ์ ๋ฌธ] 01. Machine Learning ์ฉ์ด์ ๊ฐ๋ ์ค๋ช
[๋จธ์ ๋ฌ๋ ์ ๋ฌธ] 01. Machine Learning ์ฉ์ด์ ๊ฐ๋ ์ค๋ช
2019.07.01