Python3.6.8安装TensorFlow (windows)

一、安装Python3.6.8

https://www.python.org/downloads/windows/ 打开网址,找到合适的安装包,我用的是64位

为了省事儿可以在安装第一页下面勾选“Add Path

验证:cmd命令行输入

python --version

二、安装TensorFlow

pip install tensorflow

到这里要是成功完事儿了的话,直接转“四、测试TensorFlow”

——————————分割线———————————

二、安装Anaconda

这个一定要和python的版本相对应,可以参考https://blog.csdn.net/yuejisuo1948/article/details/81043823

我用的是anaconda3-5.2.0,下载地址https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

也建议勾选“Add Anaconda to my Path

验证:cmd命令行输入

conda --version

三、安装TensorFlow

在window搜索处输入

Anaconda Prompt

选择,打开命令行界面(本文后续全部操作都在这个窗口中进行),输入

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

修改镜像地址到国内清华。

安装TensorFlow,后面的版本号根据你自己本机上python的版本设置:

conda create -n tensorflow python=3.6.8

等待一下,输入“y”:

完成安装后,输入

pip install -I  https://mirrors.tuna.tsinghua.edu.cn/tensorflow/windows/cpu/tensorflow-1.3.0rc0-cp36-cp36m-win_amd64.whl

注意pip的选项中使用大写的“I”。

这样表示安装成功。

但是也可能会报错:

(1)问题1

distributed 1.21.8 requires msgpack, which is not installed.

输入:

pip install msgpack-python
pip install msgpack

(2)问题2

ERROR: tensorflow-tensorboard 1.5.1 has requirement bleach==1.5.0, but you'll have bleach 2.1.3 which is incompatible.
ERROR: tensorflow-tensorboard 1.5.1 has requirement html5lib==0.9999999, but you'll have html5lib 1.0.1 which is incompatible.

输入:

pip install tensorflow-tensorboard

四、测试TensorFlow

在Anaconda Prompt窗口中输入

python

进入python后,输入

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

运行成功:

如果在import(划红线处)出现下述报错:

ImportError: Something is wrong with the numpy installation. While importing we detected an older version of numpy in ['E:\\Anaconda3\\lib\\site-packages\\numpy']. One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.

表示这时候电脑上numpy新旧版本同时存在,有冲突,需要重装,重复输入:

pip uninstall numpy

直到电脑上的numpy全部卸载干净,提醒:

WARNING: Skipping numpy as it is not installed.

再重新安装:

pip install numpy

完成后则继续测试。

 

五、参考引用

https://www.cnblogs.com/lvsling/p/8672404.html

https://blog.csdn.net/goodbrat/article/details/81108313

 

  • 1
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值