Tflearn坏幻数错误?

时间:2017-07-19 03:27:53

标签: python python-3.x tflearn

我收到了tflearn的错误:

Traceback (most recent call last):
  File "aaa.py", line 1, in <module>
    import tflearn
ImportError: bad magic number in 'tflearn': b'\x03\xf3\r\n'

我找到了一个卸载和重新安装的解决方案 但是,它没有用。
这是我试过的代码:

import tflearn
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.estimator import regression
import tflearn.datasets.mnist as mnist

X, Y, test_x, test_y = mnist.load_data(one_hot=True)

X = X.reshape([-1, 28, 28, 1])
test_x = test_x.reshape([-1, 28, 28, 1])

# Building convolutional convnet
convnet = input_data(shape=[None, 28, 28, 1], name='input')
# http://tflearn.org/layers/conv/
# http://tflearn.org/activations/
convnet = conv_2d(convnet, 32, 2, activation='relu')
convnet = max_pool_2d(convnet, 2)

convnet = conv_2d(convnet, 64, 2, activation='relu')
convnet = max_pool_2d(convnet, 2)

convnet = fully_connected(convnet, 1024, activation='relu')
convnet = dropout(convnet, 0.8)

convnet = fully_connected(convnet, 10, activation='softmax')
convnet = regression(convnet, optimizer='adam', learning_rate=0.01, loss='categorical_crossentropy', name='targets')

model = tflearn.DNN(convnet)
model.load('quicktest.model')

请帮助。

1 个答案:

答案 0 :(得分:0)

正在删除.pyc文件。

  tflearn安装目录中的

find . -name '*.pyc' -delete为   建议在stackoverflow.com / a / 514395 / 7738328`