美文网首页
TensorFlow安装

TensorFlow安装

作者: xhh199090 | 来源:发表于2020-03-13 13:38 被阅读0次

    TensorFlow在windows上只支持python3.5+

    1、安装python,这里安装python3.7.0

    2、安装Anaconda(和安装的python版本一致)

    下载地址:https://www.anaconda.com/distribution/
    安装完成后,检测anaconda环境是否安装成功:conda --version

    3、安装TensorFlow

    安装Tensorflow时,需要从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.7.0
    


    tensorflow安装成功,激活一下,紧接着输入:

    conda activate tensorflow
    

    tensorflow有两个版本,这里我们要安装的是CPU版本,那么在命令下紧接着输入:
    pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow==1.14.0

    至此安装完成,下面进行测试:
    在Anaconda Prompt窗口中输入: python
    进入python后输入:

    import tensorflow as tf
    sess = tf.Session()
    a = tf.constant(10)
    b= tf.constant(12)
    sess.run(a+b)
    

    tensorflow使用时cpu编译不支持问题解决,在代码中加入如下代码,忽略警告:

    import os
    os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
    

    或者换成支持cpu用AVX2编译的Tensorflow版本(github上下载源码)

    4、开发工具pycharm

    下载地址:https://www.jetbrains.com/pycharm/download/#section=windows
    专业版破解:
    下载破解包:JetbrainsIdesCrack-4.2-release-enc.jar,放入PyCharm 2018.3.6\bin目录下
    修改\bin目录下文件:pycharm.exe.vmoptions 和 pycharm64.exe.vmoptions
    最后一行添加:-javaagent:D:\ProgramFiles\PyCharm 2018.3.6\bin\JetbrainsIdesCrack-4.2-release-enc.jar

    启动Pycharm ,选择激活码激活,输入如下内容激活;
    ThisCrackLicenseId-{
    "licenseId":"11011",
    "licenseeName":"WeChat",
    "assigneeName":"IT--Pig",
    "assigneeEmail":"1113449881@qq.com",
    "licenseRestriction":"",
    "checkConcurrentUse":false,
    "products":[
    {"code":"II","paidUpTo":"2099-12-31"},
    {"code":"DM","paidUpTo":"2099-12-31"},
    {"code":"AC","paidUpTo":"2099-12-31"},
    {"code":"RS0","paidUpTo":"2099-12-31"},
    {"code":"WS","paidUpTo":"2099-12-31"},
    {"code":"DPN","paidUpTo":"2099-12-31"},
    {"code":"RC","paidUpTo":"2099-12-31"},
    {"code":"PS","paidUpTo":"2099-12-31"},
    {"code":"DC","paidUpTo":"2099-12-31"},
    {"code":"RM","paidUpTo":"2099-12-31"},
    {"code":"CL","paidUpTo":"2099-12-31"},
    {"code":"PC","paidUpTo":"2099-12-31"}
    ],
    "hash":"2911276/0",
    "gracePeriodDays":7,
    "autoProlongated":false}
    

    相关文章

      网友评论

          本文标题:TensorFlow安装

          本文链接:https://www.haomeiwen.com/subject/ofgfjhtx.html