error while importing keras ModuleNotFoundError: No module named 'tensorflow.examples'; 'tensorflow' is not a package
我试过导入keras,但它说:
import keras
Using TensorFlow backend.
Traceback (most recent call last):
File"", line 1, in
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/keras/init.py", line 3, in
from . import utils
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/keras/utils/init.py", line 6, in
from . import conv_utils
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/keras/utils/conv_utils.py", line 9, in
from .. import backend as K
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/keras/backend/init.py", line 89, in
from .tensorflow_backend import *
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/keras/backend/tensorflow_backend.py", line 5, in
import tensorflow as tf
File"/Users/elanchezhian/tensorflow.py", line 2, in
from tensorflow.examples.tutorials.mnist import input_data
ModuleNotFoundError: No module named 'tensorflow.examples'; 'tensorflow' is not a packageBLOCKQUOTE>
BLOCKQUOTE>我正在使用mac os high sierra,我在python3中运行keras,我用pip安装了keras
编辑:好的,我已经有一个名为tensorflow.py的文件,我删除了它,并出现了新的错误
Traceback(最近一次调用最后一次):
文件",第1行,in
文件"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/init.py",第3行,in
来自。 import utils
文件"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/utils/init.py",第6行,in
来自。 import conv_utils
文件"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/utils/conv_utils.py",第9行,in
from ..导入后端为K.
文件"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/backend/init.py",第89行,
来自.tensorflow_backend import *
文件"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py",第5行,in
导入张量流为tf
ImportError:'tensorflow'中的错误幻数:b' x03 xf3 r n'编辑:我已删除tensorflow.pyc现在出现此错误:
1
2
3
4
5
6
7
8
9
10 RuntimeError: module compiled against API version 0xc but this version
of
numpy is 0xb
ImportError: numpy.core.multiarray failed to import
ImportError: numpy.core.umath failed to import
ImportError: numpy.core.umath failed to import
2018-10-21 10:53:26.723451: F
tensorflow/python/lib/core/bfloat16.cc:675]
Check failed: PyBfloat16_Type.tp_base != nullptr
Abort trap: 6
您的脚本名为
tensorflow.py ,它与实际tensorflow包的名称冲突。 将脚本命名为其他内容。