케라스(Keras)를 설치해서 사용하기
아나콘다가 설치되어 있고 텐서플로우가 설치되어 있는 경우에 추가로 케라스를 설치할 수 있습니다.
(C:\Users\jonathan\Anaconda3) C:\Users\jonathan>cd \
(C:\Users\jonathan\Anaconda3) C:\>mkdir Projects
(C:\Users\jonathan\Anaconda3) C:\>cd Projects
아래와 같이 keres_talk폴더를 만들어서 사용합니다.
(C:\Users\jonathan\Anaconda3) C:\Projects>mkdir keres_talk
(C:\Users\jonathan\Anaconda3) C:\Projects>cd keres_talk
(C:\Users\jonathan\Anaconda3) C:\Projects\keres_talk>conda create -n venv python=3.6 anaconda
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment C:\Users\jonathan\Anaconda3\envs\venv:
The following NEW packages will be INSTALLED:
alabaster: 0.7.10-py36hcd07829_0
anaconda: 5.0.1-py36h8316230_2
설치할 때 y를 입력한다.
Proceed ([y]/n)? y
DEBUG menuinst_win32:__init__(185): Menu: name: 'Anaconda${PY_VER} ${PLATFORM}', prefix: 'C:\Users\jonathan\Anaconda3\envs\venv', env_name: 'venv', mode: 'None', used_mode: 'user'
DEBUG menuinst_win32:create(299): Shortcut cmd is %windir%\System32\cmd.exe, args are ['"/K"', 'C:\\Users\\jonathan\\Anaconda3\\Scripts\\activate.bat', 'C:\\Users\\jonathan\\Anaconda3\\envs\\venv']
가상환경을 활성화 할 때 아래와 같이 한다.
(C:\Users\jonathan\Anaconda3) C:\Projects\keres_talk>activate venv
(venv) C:\Projects\keres_talk>conda install -n venv ipython notebook
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment C:\Users\jonathan\Anaconda3\envs\venv:
The following NEW packages will be INSTALLED:
pywinpty: 0.5-py36h6538335_1
주피터 노트북 실행
(venv) C:\Projects\keres_talk>jupyter notebook
[I 12:23:37.582 NotebookApp] The port 8888 is already in use, trying another port.
[I 12:23:37.689 NotebookApp] Serving notebooks from local directory: C:\Projects\keres_talk
[I 12:23:37.689 NotebookApp] 0 active kernels
[I 12:23:37.690 NotebookApp] The Jupyter Notebook is running at:
[I 12:23:37.690 NotebookApp] http://localhost:8889/?token=0ae5eedc5095e957bd51fd3fb4f3c71421fb1935a7f737dc
[I 12:23:37.690 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 12:23:37.695 NotebookApp]
추가 설치
(venv) C:\Projects\keres_talk>conda install -n venv numpy matplotlib pandas pydotplus h5py scikit-learn
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment C:\Users\jonathan\Anaconda3\envs\venv:
The following NEW packages will be INSTALLED:
pydotplus: 2.0.2-py36_0
The following packages will be UPDATED:
h5py: 2.7.0-py36hfbe0a52_1 --> 2.7.1-py36h20531f2_0
llvmlite: 0.20.0-py36_0 --> 0.21.0-py36he0b0552_0
matplotlib: 2.1.0-py36h11b4b9c_0 --> 2.1.2-py36h016c42a_0
티아노 설치
(venv) C:\Projects\keres_talk>conda install -n venv theano pygpu
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment C:\Users\jonathan\Anaconda3\envs\venv:
The following NEW packages will be INSTALLED:
libgpuarray: 0.7.5-hfa6e2cd_0
libpython: 2.1-py36_0
m2w64-binutils: 2.25.1-5
m2w64-bzip2: 1.0.6-6
m2w64-crt-git: 5.0.0.4636.2595836-2
텐서플로 설치
(venv) C:\Projects\keres_talk>conda install -n venv git graphviz
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment C:\Users\jonathan\Anaconda3\envs\venv:
The following NEW packages will be INSTALLED:
git: 2.16.1-0
graphviz: 2.38.0-4
Proceed ([y]/n)? y
git-2.16.1-0.t 100% |###############################| Time: 0:00:02 6.55 MB/s
graphviz-2.38. 100% |###############################| Time: 0:00:04 8.54 MB/s
(venv) C:\Projects\keres_talk>conda install -n venv tensorflow
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment C:\Users\jonathan\Anaconda3\envs\venv:
The following NEW packages will be INSTALLED:
깃으로 받아서 setup.py로 케라스 설치
(venv) C:\Projects\keres_talk>git clone https://github.com/fchollet/keras.git
Cloning into 'keras'...
remote: Counting objects: 26228, done.
remote: Compressing objects: 100% (8/8), done.
Receiving objects: 100% (26228/26228), 10.30 MiB | 7.14 MiB/s, done.
remote: Total 26228 (delta 1), reused 0 (delta 0), pack-reused 26220
Resolving deltas: 100% (18928/18928), done.
(venv) C:\Projects\keres_talk>cd keras
(venv) C:\Projects\keres_talk\keras>python setup.py install
running install
running bdist_egg
running egg_info
creating Keras.egg-info
writing Keras.egg-info\PKG-INFO
주피터 노트북을 실행한다.
(venv) C:\Projects\keres_talk\keras>jupyter notebook
[I 12:37:58.351 NotebookApp] The port 8888 is already in use, trying another port.
[I 12:37:58.480 NotebookApp] Serving notebooks from local directory: C:\Projects\keres_talk\keras
[I 12:37:58.480 NotebookApp] 0 active kernels
[I 12:37:58.481 NotebookApp] The Jupyter Notebook is running at:
[I 12:37:58.482 NotebookApp] http://localhost:8889/?token=e7fe37d9869ef80749773f4a311010265628e49e51297977
[I 12:37:58.482 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 12:37:58.487 NotebookApp]