0

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

python -c "import tf2onnx"

但是,如果我使用 Jupyter notebook 运行相同的命令(在激活 env 之后),我会收到以下错误:

---------------------------------------------------------------------------
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 运行此命令有什么区别?

提前致谢

4

0 回答 0