window10系统安装Anaconda+tensorflow+python3.5

版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/zht741322694/article/details/86548838


1、进入官网https://www.anaconda.com/download/#windows下载Anaconda,我选择的4.2版本64位,下载好后直接就是一路点击进行安装,这中间可根据自己的需要进行安装目录的更改,并且选择不加入到PATH中


2、由于安装时官网也提示不要将Anaconda加入到PATH中,以免影响其他软件,所以我们从开始菜单中点击Anaconda Prompt进入,以下都是命令操作。

--安装好后查看Anaconda版本,安装成功则显示下列版本信息
(base) C:\Users\zht>conda --version
conda 4.5.12

--查看Anaconda环境变量
(base) C:\Users\zht>conda info --envs
# conda environments:
#
base                  *  E:\Anaconda\ad

--查看支持的所有python版本
(base) C:\Users\zht>conda search --full -name python
Loading channels: done
# Name                  Version           Build  Channel
python                    2.6.8               5  pkgs/free
python                    2.6.8               6  pkgs/free
python                    2.6.9               0  pkgs/free
python                    2.6.9               1  pkgs/free
python                    2.7.3               2  pkgs/free
python                    2.7.3               3  pkgs/free
python                    2.7.3               4  pkgs/free
python                    2.7.3               5  pkgs/free
python                    2.7.3               6  pkgs/free
python                    2.7.3               7  pkgs/free
python                    2.7.4               0  pkgs/free
python                    2.7.5               0  pkgs/free
python                    2.7.5               1  pkgs/free
python                    2.7.5               2  pkgs/free
python                    2.7.6               0  pkgs/free
python                    2.7.6               2  pkgs/free
python                    2.7.7               0  pkgs/free
python                    2.7.7               1  pkgs/free
python                    2.7.7               2  pkgs/free
python                    2.7.8               0  pkgs/free
python                    2.7.9               0  pkgs/free
python                    2.7.9               1  pkgs/free
python                   2.7.10               0  pkgs/free
python                   2.7.10               1  pkgs/free
python                   2.7.10               3  pkgs/free
python                   2.7.10               4  pkgs/free
python                   2.7.10               5  pkgs/free
python                   2.7.11               0  pkgs/free
python                   2.7.11               1  pkgs/free
python                   2.7.11               2  pkgs/free
python                   2.7.11               4  pkgs/free
python                   2.7.11               5  pkgs/free
python                   2.7.12               0  pkgs/free
python                   2.7.13               0  pkgs/free
python                   2.7.13               1  pkgs/free
python                   2.7.13     h1b6d89f_16  pkgs/main
python                   2.7.13     h9912b81_15  pkgs/main
python                   2.7.13     hb034564_12  pkgs/main
python                   2.7.14     h2765ee6_18  pkgs/main
python                   2.7.14     h3e68818_15  pkgs/main
python                   2.7.14     h4084c39_22  pkgs/main
python                   2.7.14     h4a10d90_30  pkgs/main
python                   2.7.14     h4a10d90_31  pkgs/main
python                   2.7.14     h59f5a59_20  pkgs/main
python                   2.7.14     h819644d_16  pkgs/main
python                   2.7.14     h8c3f1cb_23  pkgs/main
python                   2.7.15      h2880e7c_2  pkgs/main
python                   2.7.15      h2880e7c_3  pkgs/main
python                   2.7.15      h2880e7c_4  pkgs/main
python                   2.7.15      hcb6e200_5  pkgs/main
python                   2.7.15      he216670_0  pkgs/main
python                    3.3.0               4  pkgs/free
python                    3.3.1               0  pkgs/free
python                    3.3.2               0  pkgs/free
python                    3.3.3               0  pkgs/free
python                    3.3.4               0  pkgs/free
python                    3.3.5               0  pkgs/free
python                    3.3.5               1  pkgs/free
python                    3.3.5               2  pkgs/free
python                    3.4.0               0  pkgs/free
python                    3.4.1               0  pkgs/free
python                    3.4.1               1  pkgs/free
python                    3.4.1               2  pkgs/free
python                    3.4.2               0  pkgs/free
python                    3.4.2               1  pkgs/free
python                    3.4.3               0  pkgs/free
python                    3.4.3               3  pkgs/free
python                    3.4.3               4  pkgs/free
python                    3.4.3               5  pkgs/free
python                    3.4.4               0  pkgs/free
python                    3.4.4               1  pkgs/free
python                    3.4.4               2  pkgs/free
python                    3.4.4               4  pkgs/free
python                    3.4.4               5  pkgs/free
python                    3.4.5               0  pkgs/free
python                    3.5.0               0  pkgs/free
python                    3.5.0               1  pkgs/free
python                    3.5.0               2  pkgs/free
python                    3.5.0               3  pkgs/free
python                    3.5.0               4  pkgs/free
python                    3.5.1               0  pkgs/free
python                    3.5.1               1  pkgs/free
python                    3.5.1               2  pkgs/free
python                    3.5.1               4  pkgs/free
python                    3.5.1               5  pkgs/free
python                    3.5.2               0  pkgs/free
python                    3.5.3               0  pkgs/free
python                    3.5.3               2  pkgs/free
python                    3.5.3               3  pkgs/free
python                    3.5.4               0  pkgs/free
python                    3.5.4     h1357f44_23  pkgs/main
python                    3.5.4     hc495aa9_21  pkgs/main
python                    3.5.4     hd3c4935_11  pkgs/main
python                    3.5.4     hdec4e59_20  pkgs/main
python                    3.5.4     hedc2606_15  pkgs/main
python                    3.5.5      h0c2934d_0  pkgs/main
python                    3.5.5      h0c2934d_1  pkgs/main
python                    3.5.5      h0c2934d_2  pkgs/main
python                    3.5.6      he025d50_0  pkgs/main
 

--查看python安装版本
(base) C:\Users\zht>python --version
Python 3.5.1

--激活tensorflow,但是因为没有在Anaconda下创建tensorflow环境所以激活失败
(base) C:\Users\zht>activate tensorflow
Could not find conda environment: tensorflow
You can list all discoverable environments with `conda info --envs`.

--在Anaconda环境中创建tensorflow并使用python=3.5版本,这里一定要了解tensorflow在windows上最高支持版本
(base) C:\Users\zht>conda create -n tensorflow python=3.5.1
Solving environment: done

## Package Plan ##

  environment location: E:\Anaconda\ad\envs\tensorflow

  added / updated specs:
    - python=3.5.1


The following NEW packages will be INSTALLED:

    ca-certificates: 2018.03.07-0
    certifi:         2018.11.29-py35_0
    openssl:         1.1.1a-he774522_0
    pip:             18.1-py35_0
    python:          3.7.1-h8c8aaf0_6
    setuptools:      40.6.3-py35_0
    sqlite:          3.26.0-he774522_0
    vc:              14.1-h0510ff6_4
    vs2015_runtime:  14.15.26706-h3a45250_0
    wheel:           0.32.3-py35_0
    wincertstore:    0.2-py35_0

Proceed ([y]/n)? --输入y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate tensorflow
#
# To deactivate an active environment, use
#
#     $ conda deactivate

--查看当前所有的环境变量
(base) C:\Users\zht>conda info --envs
# conda environments:
#
base                  *  E:\Anaconda\ad
tensorflow               E:\Anaconda\ad\envs\tensorflow  --说明环境创建好了

--激活tensorflow环境,注意这里只是环境
(base) C:\Users\zht>activate tensorflow

--安装tensorflow,我就是因为没有这一步发现到PyCharm中怎么都无法引入tensorflow包,如果是GPU的tensorflow-gpu 
(tensorflow) C:\Users\zht>pip install --upgrade --ignore-installed tensorflow

--进入python环境
(tensorflow) C:\Users\zht>python 

--退出tensorflow
(tensorflow) C:\Users\zht>deactivate tensorflow

python开发工具PyCharm的下载:http://www.jetbrains.com/pycharm/download

注意下面这步选择python解释器的路径,一定要是Anadonda中tensorflow环境的python.exe,否则将无法使用tensorflow包

PyCharm中File-->setting里面选择找到我们安装的Anadonda中的env中的tensorflow中的python.exe的python解释器

猜你喜欢

转载自blog.csdn.net/zht741322694/article/details/86548838