インストール
https://conda.io/miniconda.html上記より Python 3.7 Windows 64-bit (exe installer) をダウンロード
ダウンロードした Miniconda3-latest-Windows-x86_64.exe を実行しインストール
パラメータはすべて既定値のままとした
インストール完了したら、スタートメニューより [Anaconda Prompt] を起動する
仮想環境作成
例) "Introtensorflow"という名前の仮想環境を作成"conda create"コマンドで仮想環境を作成できる。仮想環境の名前は "-n" オプションで指定
(base) C:\Users\user>conda create -n introtensorflow Solving environment: done ## Package Plan ## environment location: C:\Users\user\Miniconda3\envs\introtensorflow Proceed ([y]/n)? y Preparing transaction: done Verifying transaction: done Executing transaction: done # # To activate this environment, use # # $ conda activate introtensorflow # # To deactivate an active environment, use # # $ conda deactivate (base) C:\Users\user>
仮想環境の一覧表示
"conda info -e"コマンドを使う(base) C:\Users\user>conda info -e # conda environments: # base * C:\Users\user\Miniconda3 introtensorflow C:\Users\user\Miniconda3\envs\introtensorflow (base) C:\Users\user>
アクティベーション
仮想環境を使えるようにアクティベーションする"conda activate (仮想名)"
(base) C:\Users\user>conda activate introtensorflow (introtensorflow) C:\Users\user>l
仮想環境を終了するには "conda deactivate" と入力
(introtensorflow) C:\Users\user>conda deactivate (base) C:\Users\user>
Jupyter Notebookインストール
先ほど仮想環境をディアクティベートしたので、再度アクティベート後、"conda install"コマンドでJupyter Notebookをインストールする。(base) C:\Users\user>conda activate introtensorflow (introtensorflow) C:\Users\user>conda install jupyter Solving environment: done ## Package Plan ## environment location: C:\Users\user\Miniconda3\envs\introtensorflow added / updated specs: - jupyter The following packages will be downloaded: package | build ---------------------------|----------------- backcall-0.1.0 | py37_0 19 KB pyqt-5.9.2 | py37h6538335_2 4.2 MB send2trash-1.5.0 | py37_0 16 KB pyzmq-17.1.2 | py37hfa6e2cd_0 400 KB libsodium-1.0.16 | h9d3ae62_0 585 KB pywinpty-0.5.5 | py37_1000 48 KB pickleshare-0.7.5 | py37_0 13 KB jpeg-9b | hb83a4c4_2 313 KB jinja2-2.10 | py37_0 183 KB jupyter_console-6.0.0 | py37_0 53 KB entrypoints-0.3 | py37_0 12 KB nbconvert-5.3.1 | py37_0 422 KB ipython-7.2.0 | py37h39e3cac_0 1.1 MB zeromq-4.2.5 | he025d50_1 9.5 MB jupyter-1.0.0 | py37_7 6 KB tornado-5.1.1 | py37hfa6e2cd_0 665 KB testpath-0.4.2 | py37_0 92 KB qtconsole-4.4.3 | py37_0 176 KB decorator-4.3.0 | py37_0 15 KB m2w64-gcc-libs-5.3.0 | 7 518 KB traitlets-4.3.2 | py37_0 133 KB m2w64-gmp-6.1.0 | 2 689 KB m2w64-libwinpthread-git-5.0.0.4634.697f757| 2 30 KB icu-58.2 | ha66f8fd_1 21.9 MB terminado-0.8.1 | py37_1 21 KB wcwidth-0.1.7 | py37_0 23 KB sip-4.19.8 | py37h6538335_0 281 KB ipython_genutils-0.2.0 | py37_0 39 KB m2w64-gcc-libgfortran-5.3.0| 6 340 KB pandoc-2.2.3.2 | 0 21.0 MB pandocfilters-1.4.2 | py37_1 13 KB qt-5.9.7 | vc14h73c81de_0 92.3 MB jupyter_core-4.4.0 | py37_0 85 KB markupsafe-1.1.0 | py37he774522_0 29 KB notebook-5.7.4 | py37_0 7.3 MB jsonschema-2.6.0 | py37_0 104 KB widgetsnbextension-3.4.2 | py37_0 1.7 MB libpng-1.6.36 | h2a8f88b_0 550 KB m2w64-gcc-libs-core-5.3.0 | 7 213 KB jedi-0.13.2 | py37_0 230 KB python-3.7.2 | h8c8aaf0_0 17.7 MB ipywidgets-7.4.2 | py37_0 151 KB python-dateutil-2.7.5 | py37_0 276 KB bleach-3.1.0 | py37_0 222 KB jupyter_client-5.2.4 | py37_0 203 KB prompt_toolkit-2.0.7 | py37_0 479 KB mistune-0.8.4 | py37he774522_0 54 KB ca-certificates-2018.12.5 | 0 153 KB winpty-0.4.3 | 4 1.1 MB parso-0.3.1 | py37_0 114 KB colorama-0.4.1 | py37_0 24 KB pygments-2.3.1 | py37_0 1.3 MB ipykernel-5.1.0 | py37h39e3cac_0 156 KB msys2-conda-epoch-20160418 | 1 2 KB prometheus_client-0.5.0 | py37_0 67 KB nbformat-4.4.0 | py37_0 160 KB zlib-1.2.11 | h62dcd97_3 128 KB webencodings-0.5.1 | py37_1 19 KB ------------------------------------------------------------ Total: 187.5 MB The following NEW packages will be INSTALLED: backcall: 0.1.0-py37_0 bleach: 3.1.0-py37_0 ca-certificates: 2018.12.5-0 certifi: 2018.11.29-py37_0 colorama: 0.4.1-py37_0 decorator: 4.3.0-py37_0 entrypoints: 0.3-py37_0 icu: 58.2-ha66f8fd_1 ipykernel: 5.1.0-py37h39e3cac_0 ipython: 7.2.0-py37h39e3cac_0 ipython_genutils: 0.2.0-py37_0 ipywidgets: 7.4.2-py37_0 jedi: 0.13.2-py37_0 jinja2: 2.10-py37_0 jpeg: 9b-hb83a4c4_2 jsonschema: 2.6.0-py37_0 jupyter: 1.0.0-py37_7 jupyter_client: 5.2.4-py37_0 jupyter_console: 6.0.0-py37_0 jupyter_core: 4.4.0-py37_0 libpng: 1.6.36-h2a8f88b_0 libsodium: 1.0.16-h9d3ae62_0 m2w64-gcc-libgfortran: 5.3.0-6 m2w64-gcc-libs: 5.3.0-7 m2w64-gcc-libs-core: 5.3.0-7 m2w64-gmp: 6.1.0-2 m2w64-libwinpthread-git: 5.0.0.4634.697f757-2 markupsafe: 1.1.0-py37he774522_0 mistune: 0.8.4-py37he774522_0 msys2-conda-epoch: 20160418-1 nbconvert: 5.3.1-py37_0 nbformat: 4.4.0-py37_0 notebook: 5.7.4-py37_0 openssl: 1.1.1a-he774522_0 pandoc: 2.2.3.2-0 pandocfilters: 1.4.2-py37_1 parso: 0.3.1-py37_0 pickleshare: 0.7.5-py37_0 pip: 18.1-py37_0 prometheus_client: 0.5.0-py37_0 prompt_toolkit: 2.0.7-py37_0 pygments: 2.3.1-py37_0 pyqt: 5.9.2-py37h6538335_2 python: 3.7.2-h8c8aaf0_0 python-dateutil: 2.7.5-py37_0 pywinpty: 0.5.5-py37_1000 pyzmq: 17.1.2-py37hfa6e2cd_0 qt: 5.9.7-vc14h73c81de_0 qtconsole: 4.4.3-py37_0 send2trash: 1.5.0-py37_0 setuptools: 40.6.3-py37_0 sip: 4.19.8-py37h6538335_0 six: 1.12.0-py37_0 sqlite: 3.26.0-he774522_0 terminado: 0.8.1-py37_1 testpath: 0.4.2-py37_0 tornado: 5.1.1-py37hfa6e2cd_0 traitlets: 4.3.2-py37_0 vc: 14.1-h0510ff6_4 vs2015_runtime: 14.15.26706-h3a45250_0 wcwidth: 0.1.7-py37_0 webencodings: 0.5.1-py37_1 wheel: 0.32.3-py37_0 widgetsnbextension: 3.4.2-py37_0 wincertstore: 0.2-py37_0 winpty: 0.4.3-4 zeromq: 4.2.5-he025d50_1 zlib: 1.2.11-h62dcd97_3 Proceed ([y]/n)? y Downloading and Extracting Packages backcall-0.1.0 | 19 KB | #################################### | 100% pyqt-5.9.2 | 4.2 MB | #################################### | 100% send2trash-1.5.0 | 16 KB | #################################### | 100% pyzmq-17.1.2 | 400 KB | #################################### | 100% libsodium-1.0.16 | 585 KB | #################################### | 100% pywinpty-0.5.5 | 48 KB | #################################### | 100% pickleshare-0.7.5 | 13 KB | #################################### | 100% jpeg-9b | 313 KB | #################################### | 100% jinja2-2.10 | 183 KB | #################################### | 100% jupyter_console-6.0. | 53 KB | #################################### | 100% entrypoints-0.3 | 12 KB | #################################### | 100% nbconvert-5.3.1 | 422 KB | #################################### | 100% ipython-7.2.0 | 1.1 MB | #################################### | 100% zeromq-4.2.5 | 9.5 MB | #################################### | 100% jupyter-1.0.0 | 6 KB | #################################### | 100% tornado-5.1.1 | 665 KB | #################################### | 100% testpath-0.4.2 | 92 KB | #################################### | 100% qtconsole-4.4.3 | 176 KB | #################################### | 100% decorator-4.3.0 | 15 KB | #################################### | 100% m2w64-gcc-libs-5.3.0 | 518 KB | #################################### | 100% traitlets-4.3.2 | 133 KB | #################################### | 100% m2w64-gmp-6.1.0 | 689 KB | #################################### | 100% m2w64-libwinpthread- | 30 KB | #################################### | 100% icu-58.2 | 21.9 MB | #################################### | 100% terminado-0.8.1 | 21 KB | #################################### | 100% wcwidth-0.1.7 | 23 KB | #################################### | 100% sip-4.19.8 | 281 KB | #################################### | 100% ipython_genutils-0.2 | 39 KB | #################################### | 100% m2w64-gcc-libgfortra | 340 KB | #################################### | 100% pandoc-2.2.3.2 | 21.0 MB | #################################### | 100% pandocfilters-1.4.2 | 13 KB | #################################### | 100% qt-5.9.7 | 92.3 MB | #################################### | 100% jupyter_core-4.4.0 | 85 KB | #################################### | 100% markupsafe-1.1.0 | 29 KB | #################################### | 100% notebook-5.7.4 | 7.3 MB | #################################### | 100% jsonschema-2.6.0 | 104 KB | #################################### | 100% widgetsnbextension-3 | 1.7 MB | #################################### | 100% libpng-1.6.36 | 550 KB | #################################### | 100% m2w64-gcc-libs-core- | 213 KB | #################################### | 100% jedi-0.13.2 | 230 KB | #################################### | 100% python-3.7.2 | 17.7 MB | #################################### | 100% ipywidgets-7.4.2 | 151 KB | #################################### | 100% python-dateutil-2.7. | 276 KB | #################################### | 100% bleach-3.1.0 | 222 KB | #################################### | 100% jupyter_client-5.2.4 | 203 KB | #################################### | 100% prompt_toolkit-2.0.7 | 479 KB | #################################### | 100% mistune-0.8.4 | 54 KB | #################################### | 100% ca-certificates-2018 | 153 KB | #################################### | 100% winpty-0.4.3 | 1.1 MB | #################################### | 100% parso-0.3.1 | 114 KB | #################################### | 100% colorama-0.4.1 | 24 KB | #################################### | 100% pygments-2.3.1 | 1.3 MB | #################################### | 100% ipykernel-5.1.0 | 156 KB | #################################### | 100% msys2-conda-epoch-20 | 2 KB | #################################### | 100% prometheus_client-0. | 67 KB | #################################### | 100% nbformat-4.4.0 | 160 KB | #################################### | 100% zlib-1.2.11 | 128 KB | #################################### | 100% webencodings-0.5.1 | 19 KB | #################################### | 100% Preparing transaction: done Verifying transaction: done Executing transaction: \ DEBUG menuinst_win32:__init__(196): Menu: name: 'Anaconda${PY_VER} ${PLATFORM}', prefix: 'C:\Users\user\Miniconda3\envs\introtensorflow', env_name: 'introtensorflow', mode: 'user', used_mode: 'user' DEBUG menuinst_win32:create(320): Shortcut cmd is C:\Users\user\Miniconda3\python.exe, args are ['C:\\Users\\user\\Miniconda3\\cwp.py', 'C:\\Users\\user\\Miniconda3\\envs\\introtensorflow', 'C:\\Users\\user\\Miniconda3\\envs\\introtensorflow\\python.exe', 'C:\\Users\\user\\Miniconda3\\envs\\introtensorflow\\Scripts\\jupyter-notebook-script.py', '"%USERPROFILE%/"'] done (introtensorflow) C:\Users\user>
TensorFlowインストール
CPU版とGPU版でパッケージ名が異なるここではCPU版をインストールする "pip --no-cache-dir install -I -U tensorflow"
(introtensorflow) C:\Users\user>pip --no-cache-dir install -I -U tensorflow Collecting tensorflow Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow (introtensorflow) C:\Users\user>… うまくいっていないような…
Python3.7はダメ?
いったん仮想環境を削除
(base) C:\Users\user>conda env remove -n introtensorflow
Python3.6で仮想構築
(base) C:\Users\user>conda create -n introtensorflow python=3.6 Solving environment: done ## Package Plan ## environment location: C:\Users\user\Miniconda3\envs\introtensorflow added / updated specs: - python=3.6 The following packages will be downloaded: package | build ---------------------------|----------------- certifi-2018.11.29 | py36_0 146 KB pip-18.1 | py36_0 1.8 MB wincertstore-0.2 | py36h7fe50ca_0 13 KB wheel-0.32.3 | py36_0 53 KB python-3.6.8 | h9f7ef89_0 20.3 MB setuptools-40.6.3 | py36_0 625 KB ------------------------------------------------------------ Total: 22.9 MB The following NEW packages will be INSTALLED: certifi: 2018.11.29-py36_0 pip: 18.1-py36_0 python: 3.6.8-h9f7ef89_0 setuptools: 40.6.3-py36_0 sqlite: 3.26.0-he774522_0 vc: 14.1-h0510ff6_4 vs2015_runtime: 14.15.26706-h3a45250_0 wheel: 0.32.3-py36_0 wincertstore: 0.2-py36h7fe50ca_0 Proceed ([y]/n)? y Downloading and Extracting Packages certifi-2018.11.29 | 146 KB | #################################### | 100% pip-18.1 | 1.8 MB | #################################### | 100% wincertstore-0.2 | 13 KB | #################################### | 100% wheel-0.32.3 | 53 KB | #################################### | 100% python-3.6.8 | 20.3 MB | #################################### | 100% setuptools-40.6.3 | 625 KB | #################################### | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done # # To activate this environment, use # # $ conda activate introtensorflow # # To deactivate an active environment, use # # $ conda deactivate (base) C:\Users\user>
アクティベート
(base) C:\Users\user>conda activate introtensorflow
もう一度tensorflowインストール
(introtensorflow) C:\Users\user>pip --no-cache-dir install -I -U tensorflow Collecting tensorflow Downloading https://files.pythonhosted.org/packages/05/cd/c171d2e33c0192b04560ce864c26eba83fed888fe5cd9ded661b2702f2ae/tensorflow-1.12.0-cp36-cp36m-win_amd64.whl (45.9MB) 100% |████████████████████████████████| 45.9MB ... Collecting tensorboard<1 ...="" .13.0="" 1.1mb="" 1.5mb="" 100="" 102kb="" 11.9mb="" 2.4mb="" 3.1mb="" 327kb="" 51kb="" 573kb="" 6.3mb="" 6.5mb="" 6.6mb="" 9.2mb="" 92kb="" a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981="" a7="" a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9="" a="" ab68120d1d89ae23b694a55fe2aece2f91194313b71f9b05a80b32d3c24b="" absl-py-0.7.0.tar.gz="" absl-py-0.7.0="" absl-py="" arkdown-3.0.1-py2.py3-none-any.whl="" astor-0.7.1-py2.py3-none-any.whl="" astor-0.7.1="" astor="" b="" ba15545ec37d2f7f58844d690baf2f81f3a60b862e48f29287="" bb="" bc="" bf99b2d4e3cceb4d55ca22590b0d7c2c62b9de38ac4a4a7f4687421="" c4403544a91001d9c618748b2e8786db45544e36b8a6cf3c525e9b57f="" c4="" c:="" cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f="" caf971b0d2d48f151c2586f62902d93dc908e2fd9b9b9f6aa3c9dd="" collected="" collecting="" d32ce9471c18f8d99028b7cef2e5b39ea8765bd7ef250ca05b490880971="" d606d07cff0fc8d22abcc54006c0247002d11a7f2d218eb008d48e76851d="" df="" dfa4795e24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9="" done="" downloading="" e0fa783d3fc07e41715973435dd051ca89c550881b3454233c39c73e69="" e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243="" e8="" e="" eras_applications-1.0.6-py2.py3-none-any.whl="" eras_preprocessing-1.0.5-py2.py3-none-any.whl="" erkzeug-0.14.1-py2.py3-none-any.whl="" f7e4f9b9d7078aa0e701500634f832f145855a11beb098d3b0fb1="" f="" fa027f411616f6e7c5899a8e3e1ab2e101808f8d62b6ee8b645411ed270b="" fb="" fc="" ff40221029f7098d58f8d7fb99b97e8100f3293f9856f0fb5834bef100b="" ff="" files.pythonhosted.org="" for="" from="" gast-0.2.2.tar.gz="" gast-0.2.2="" gast="" grpcio-1.18.0-cp36-cp36m-win_amd64.whl="" grpcio-1.18.0="" grpcio="" gt="" h5py-2.9.0-cp36-cp36m-win_amd64.whl="" h5py-2.9.0="" h5py="" https:="" install="" installed="" installing="" introtensorflow="" kb="" keras-applications-1.0.6="" keras-applications="" keras-preprocessing-1.0.5="" keras-preprocessing="" markdown-3.0.1="" markdown="" numpy-1.16.0-cp36-cp36m-win_amd64.whl="" numpy-1.16.0="" numpy="" packages:="" packages="" pre="" protobuf-3.6.1-cp36-cp36m-win_amd64.whl="" protobuf-3.6.1="" protobuf="" running="" s="" sers="" setup.py="" setuptools-40.6.3-py2.py3-none-any.whl="" setuptools-40.6.3="" setuptools="" six-1.12.0-py2.py3-none-any.whl="" six-1.12.0="" six="" successfully="" tensorboard-1.12.2-py3-none-any.whl="" tensorboard-1.12.2="" tensorboard="" tensorflow-1.12.0="" tensorflow="" termcolor-1.1.0.tar.gz="" termcolor-1.1.0="" termcolor="" user="" werkzeug-0.14.1="" werkzeug="" wheel-0.32.3-py2.py3-none-any.whl="" wheel-0.32.3="" wheel=""> ;… できたっぽい?
テスト
参考ページのままコマンドを実行(introtensorflow) C:\Users\user>python Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 18:50:55) [MSC v.1915 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf >>> sess = tf.InteractiveSession() 2019-01-23 23:43:20.687615: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 >>> message = tf.constant('Hello, Tensorflow!') >>> message.eval() b'Hello, Tensorflow!' >>> sess.close() >>> exit() (introtensorflow) C:\Users\user>大丈夫かな?
Jupyter Notebook起動
"jupyter notebook"と入力すれば起動するはず…(introtensorflow) C:\Users\user>jupyter notebook 'jupyter' は、内部コマンドまたは外部コマンド、 操作可能なプログラムまたはバッチ ファイルとして認識されていません。… Python3.6にするため仮想を消してからJupyter Notebook入れてなかった。 もう一度インストール
(introtensorflow) C:\Users\user>conda install jupyter
Python, Miniconda, Tensorflow, Jupyter Notebook
1>
0 件のコメント:
コメントを投稿