Windows下Anaconda安裝 python + tensorflow

來源:互聯網
上載者:User

標籤:Plan   開源   color   pack   anaconda   code   const   tool   ant   

下載安裝Anaconda

首先下載Anaconda,可以從清華大學的鏡像網站進行下載。

安裝Anaconda,注意安裝時不要將添加環境變數的選項取消掉。

安裝完成之後,在安裝目錄下cmd,輸入

conda list

可以查看Anaconda為我們提供的Integration Environment:

下面只是一部分:

查看版本資訊:

conda --version

Anaconda 安裝成功。

接下來需要設定 Anaconda 倉庫鏡像,因為預設串連的是國外鏡像地址,下載速度比較慢,我們把鏡像地址改為清華大學開源軟體鏡像站,Anaconda Prompt 視窗輸入:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --set show_channel_urls yes
安裝 TensorFlow

繼續在 Anaconda Prompt 視窗輸入:

conda create -n tensorflow python=3.5

表示建立 TensorFlow 依賴環境,TensorFlow 目前不支援Python3.6,這裡我們使用Python3.5。

控制台輸出:

Fetching package metadata ...............Solving package specifications: .Package plan for installation in environment D:\Program Files\anaconda\envs\tensorflow:The following NEW packages will be INSTALLED:    pip:            9.0.1-py35_1  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free    python:         3.5.3-0       https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free    setuptools:     27.2.0-py35_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free    vs2015_runtime: 14.0.25123-0  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free    wheel:          0.29.0-py35_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/freeProceed ([y]/n)? y

提示我們安裝哪些依賴軟體,輸入‘y’,斷行符號。

安裝 CPU 版本:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ https://mirrors.tuna.tsinghua.edu.cn/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl

啟用環境:

activate tensorflow

退出環境:

deactivate tensorflow 
測試

進入到 Anaconda 安裝目錄下 /envs /tensorflow 檔案夾,繼續在 Anaconda Prompt 視窗輸入輸入:

python.exe

輸入:

>>> import tensorflow as tf>>> hello = tf.constant(‘Hello, TensorFlow!‘)>>> sess = tf.Session()>>> sess.run(hello)b‘Hello, TensorFlow!‘ 

Windows下Anaconda安裝 python + tensorflow

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.