【问题标题】:Tflearn bad magic number error?Tflearn坏幻数错误?
【发布时间】:2017-07-19 03:27:53
【问题描述】:

我在使用 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')

请帮忙。

【问题讨论】:

  • 你似乎有一些不好的.pyc 文件(编译的 Python 文件)。按照stackoverflow.com/a/514395/7738328中的建议,在tflearn 安装目录中尝试find . -name '*.pyc' -delete 可能是值得的@

标签: python python-3.x tflearn


【解决方案1】:

删除 .pyc 文件,成功。

find . -name '*.pyc' -delete 在 tflearn 安装目录中为 在stackoverflow.com/a/514395/7738328中建议`

【讨论】:

    猜你喜欢
    • 2010-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-10
    • 1970-01-01
    相关资源
    最近更新 更多