Python Tensorflow - EOFError:编组数据太短

sno*_*kso 5 python python-3.x tensorflow

我已经面临这个问题有一段时间了。每当我导入 TensorFlow 时,我都会得到以下信息:


2021-02-11 21:05:05.855414: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2021-02-11 21:05:05.855463: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/amay428/.local/lib/python3.8/site-packages/tensorflow/__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/home/amay428/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 45, in <module>
    from tensorflow.python import data
  File "/home/amay428/.local/lib/python3.8/site-packages/tensorflow/python/data/__init__.py", line 25, in <module>
    from tensorflow.python.data import experimental
  File "/home/amay428/.local/lib/python3.8/site-packages/tensorflow/python/data/experimental/__init__.py", line 126, in <module>
    from tensorflow.python.data.experimental.ops.prefetching_ops import copy_to_device
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 779, in exec_module
  File "<frozen importlib._bootstrap_external>", line 911, in get_code
  File "<frozen importlib._bootstrap_external>", line 580, in _compile_bytecode
EOFError: marshal data too short
Run Code Online (Sandbox Code Playgroud)

我在网上查看了各种答案,但它们都要求我删除 TensorFlow _ pycache _ 文件夹。我已经这样做了,但它不起作用。我在 Conda 环境中使用 Manjaro、python 3.8。我将不胜感激任何帮助。

谢谢!

小智 1

我在尝试将在 TensorFlow v2.6.0 上训练的模型导入到使用 TensorFlow v2.7.0 的环境中时遇到了这个问题。我将环境降级回v2.6.0,这已经解决了错误。