【发布时间】:2021-05-28 01:33:16
【问题描述】:
系统信息
MacBook Air M1
Ubuntu Linux 20.04 使用虚拟机
Python 3.8.5 64 位
我已经安装了张量流,但是在导入库并编译任何代码后,它给了我以下一组错误
Traceback (most recent call last):
File "/home/mradulagrawal/Desktop/IP/image.py", line 2, in <module>
import tensorflow
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 61, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/usr/lib/python3.8/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.8/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow.so: invalid ELF header
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
mradulagrawal@ubuntu:~/Desktop$ /usr/bin/python3 /home/mradulagrawal/Desktop/IP/image.py
Traceback (most recent call last):
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 61, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/usr/lib/python3.8/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.8/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow.so: invalid ELF header
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/mradulagrawal/Desktop/IP/image.py", line 2, in <module>
import tensorflow
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 61, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/usr/lib/python3.8/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.8/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/mradulagrawal/.local/lib/python3.8/site-packages/tensorflow/python/_pywrap_tensorflow.so: invalid ELF header
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
谢谢!
【问题讨论】:
-
进展如何?只是检查一下提供的信息是否有帮助。
标签: python tensorflow visual-studio-code pip