windows7 安装TensorFlow

时间:2021-10-16 16:20:04

Win7 TensorFlow安装步骤:

1.安装python,参考http://www.zhimengzhe.com/windows/283058.html#0-tsina-1-12530-397232819ff9a47a7b7e80a40613cfe1,

此步骤注意事项:

a.注意安装的版本一定要和tensorflow对应上,因为如果安装最新的python,有可能会不兼容tensorflow。导致最终用不了tensorflow

b.命令窗口为 以管理员身份打开“windows powershell”(些步骤与上文链接有区别)

windows7 安装TensorFlow

打开窗口如下

windows7 安装TensorFlow

b.若安装后,无法识别python指令,此时需要设置环境变量(造成的原因是在安装python时没有勾选添加到path)

解决方法参考https://jingyan.baidu.com/article/bea41d436879a4b4c51be6f9.html

2.安装Tensorflow,使用pip install tensorflow,安装成功后若不用正常import tensorflow,解决过程参考http://www.zhimengzhe.com/windows/283058.html#0-tsina-1-12530-397232819ff9a47a7b7e80a40613cfe1

3.安装Pycharm(推荐),community版的就行了,下载链接http://www.jetbrains.com/pycharm/download/#section=windows

4.下载一个tensorflow的python源代码文件,用pycharm(pathon编译器)打开,当然运行前需要设置project interpreter

windows7 安装TensorFlow

设置好后可直接运行,下图为运行单层神经网络案例的结果

windows7 安装TensorFlow

当然,初次运行可能会出现类似cannot import (matplotlib )类的错误 ,比如括号内可以为sklearn,scipy等等。此类解决方法都是在windows powershell中安装即可,比如安装sklearn,窗口中输入pip install sklearn 可完成安装。

最后提供给大家我的测试源码。链接:http://pan.baidu.com/s/1slAz7jf 密码:khsn

欢迎交流!