1. 确保成功安装了tensorflow

Window系统 安装TFLearn

2. 查看当前tensorflow下的库文件,判断是否已经安装了h5py,scipy:conda list

Window系统 安装TFLearn

3. 若没有安装,安装h5py,scipy。我的电脑中没有安装h5py,安装:pip install h5py
安装scipy同理

Window系统 安装TFLearn

4. 安装tflearn
有两种安装方式
1)pip install tflearn
2) pip install git+https://github.com/tflearn/tflearn.git (要确保先安装了Git)
我使用的第一种安装方法

Window系统 安装TFLearn

5. 至此tflearn安装成功。

Window系统 安装TFLearn

6. 从tflearn官网找的一个例子:http://tflearn.org/examples/

from __future__ import absolute_import, division, print_function

import tflearn

# Regression data
X = [3.3,4.4,5.5,6.71,6.93,4.168,9.779,6.182,7.59,2.167,7.042,10.791,5.313,7.997,5.654,9.27,3.1]
Y = [1.7,2.76,2.09,3.19,1.694,1.573,3.366,2.596,2.53,1.221,2.827,3.465,1.65,2.904,2.42,2.94,1.3]

# Linear Regression graph
input_ = tflearn.input_data(shape=[None])
linear = tflearn.single_unit(input_)
regression = tflearn.regression(linear, optimizer='sgd', loss='mean_square',
                                metric='R2', learning_rate=0.01)
m = tflearn.DNN(regression)
m.fit(X, Y, n_epoch=1000, show_metric=True, snapshot_epoch=False)

print("\nRegression result:")
print("Y = " + str(m.get_weights(linear.W)) +
      "*X + " + str(m.get_weights(linear.b)))

print("\nTest prediction for x = 3.2, 3.3, 3.4:")
print(m.predict([3.2, 3.3, 3.4]))

运行结果部分截图如下:

Window系统 安装TFLearn

 


--------------------------------分割线--------------------------------------------
安装过程中遇到的错误

Window系统 安装TFLearn
1. hdf5 is not supported on this machine (please install/reinstall h5py for optimal experience)
原因:没有安装h5py,安装h5py后,问题得以解决

2. curses is not supported on this machine (please install/reinstall curses for an optimal experience)
解决方法:安装curses
安装过程:
1)如果没有安装wheel,首先通过pip命令安装wheel:pip install wheel

Window系统 安装TFLearn

2)从https://www.lfd.uci.edu/~gohlke/pythonlibs/ 下载curses‑2.2‑cp35‑none‑win_amd64.whl包

3)cd到下载的.whl的目录(如我的 ~/PythonTool)。直接输入命令 : pip install curses-2.2-cp36-cp36m-win32.whl

Window系统 安装TFLearn

参考:https://github.com/lxzheng/machine_learning/wiki/TensorFlow--%E5%92%8C-TFlearn-Windows%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97

相关文章:

  • 2022-01-04
  • 2021-09-26
  • 2021-07-14
  • 2021-08-12
  • 2021-10-20
  • 2018-10-31
猜你喜欢
  • 2021-06-07
  • 2021-10-14
  • 2021-06-04
  • 2021-04-19
  • 2021-12-14
  • 2021-12-09
相关资源
相似解决方案