通过Jupyter Notebook导入tf2onnx时出错

时间:2019-05-27 09:49:55

标签: python-3.x jupyter-notebook onnx

我在conda中有一个新的env,如果在激活env后运行以下命令,它将成功:

python -c "import tf2onnx"

但是,如果我用Jupyter笔记本运行相同的命令(在激活环境后),则会出现以下错误:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-9d842ab860c9> in <module>
----> 1 import tf2onnx

C:\Miniconda3\envs\tf\lib\site-packages\keras2onnx\ktf2onnx\tf2onnx\__init__.py in <module>
     11 from .version import version as __version__
     12 from . import logging
---> 13 from tf2onnx import tfonnx, utils, graph, graph_matcher, shape_inference, schemas  # pylint: disable=wrong-import-order

C:\Miniconda3\envs\tf\lib\site-packages\keras2onnx\ktf2onnx\tf2onnx\tfonnx.py in <module>
     23 import tf2onnx.onnx_opset  # pylint: disable=unused-import
     24 import tf2onnx.custom_opsets  # pylint: disable=unused-import
---> 25 from tf2onnx.graph import Graph
     26 from tf2onnx.graph_matcher import OpTypePattern, GraphMatcher
     27 from tf2onnx.rewriter import *  # pylint: disable=wildcard-import

C:\Miniconda3\envs\tf\lib\site-packages\keras2onnx\ktf2onnx\tf2onnx\graph.py in <module>
     19 
     20 from distutils.version import StrictVersion
---> 21 from onnx import helper, numpy_helper, shape_inference, OperatorSetIdProto, AttributeProto, version
     22 from tf2onnx import utils, __version__
     23 from tf2onnx.utils import port_name, find_opset

ImportError: cannot import name 'shape_inference'

在有或没有jupyter的情况下运行此命令会导致此错误有什么区别?

预先感谢

0 个答案:

没有答案