导入错误:无法导入名称"dtensor"



我刚买了一部Jetson Nano,用Jetpack 4.6.1创建了我的sd卡。之后,我安装TensorFlow像这样:[Tensorflow-Install] [1]

我想创建一个mnist模型,但似乎我不能导入Keras?

我刚刚安装了Tensorflow并升级了所有的apt-get包。

>>> import tensorflow.keras
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/keras/api/_v2/keras/__init__.py", line 12, in <module>
from keras import __version__
File "/usr/local/lib/python3.6/dist-packages/keras/__init__.py", line 24, in <module>
from keras import models
File "/usr/local/lib/python3.6/dist-packages/keras/models/__init__.py", line 18, in <module>
from keras.engine.functional import Functional
File "/usr/local/lib/python3.6/dist-packages/keras/engine/functional.py", line 24, in <module>
from keras.dtensor import layout_map as layout_map_lib
File "/usr/local/lib/python3.6/dist-packages/keras/dtensor/__init__.py", line 22, in <module>
from tensorflow.compat.v2.experimental import dtensor as dtensor_api  # pylint: disable=g-import-not-at-top
ImportError: cannot import name 'dtensor'
>>>

我将感激任何帮助![1]: https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html

尝试sudo pip3卸载keras,显然版本2.9.0rc2有错误,然后pip3安装keras==2.7.0rc2,检查兼容性,https://libraries.io/pypi/keras/2.9.0rc2,我不知道这是否是jetpack 4.6.1的最终解决方案

必须在site-package中删除tensorflow和keras文件夹。打开管理命令提示符,使用这些代码

pip uninstall tensorflow 
pip install tensorflow --ignore-installed

相关内容

  • 没有找到相关文章