windows10 tensorflow-gpu 설치
아래와 같은 에러가 뜨면서 아무리 메뉴얼대로 설치해도 잘 안되는경우가 있다.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\kohry\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\kohry\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\kohry\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\kohry\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\kohry\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\kohry\Anaconda3\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 "C:\Users\kohry\Anaconda3\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\kohry\Anaconda3\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 지정된 모듈을 찾을 수 없습니다.
아나콘다로 설치하면 편하다.
1) 일단 가상환경을 만들고,
conda create --name tf-gpu
2) 가상환경에 들어가자
activate tf-gpu
3) 그리고 cuda, cdnn다 깐다.
(tf-gpu) C:\Users\xx> conda install -c aaronzs tensorflow-gpu
(tf-gpu) C:\Users\xx> conda install -c anaconda cudatoolkit
(tf-gpu) C:\Users\xx> conda install -c anaconda cudnn
4) 실행시킨다.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
그럼 위와같이 잘 나온다. 3만원짜리 똥그래픽카드도 잘나온다.