apple / tensorflow_macos

TensorFlow for macOS 11.0+ accelerated using Apple's ML Compute framework.
Other
3.67k stars 308 forks source link

import error : Reason: image not found #225

Open ghost opened 3 years ago

ghost commented 3 years ago

when I run import tensorflow on my M1 Mac , I got the Reason: image not found Error.

ghost commented 3 years ago

I suddenly cannot run import tensorflow (either in terminal or pycharm),The following is the specific error:

>>> import tensorflow
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/pkwang/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/__init__.py", line 41, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/Users/pkwang/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/__init__.py", line 41, in <module>
    from tensorflow.python.eager import context
  File "/Users/pkwang/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/eager/context.py", line 35, in <module>
    from tensorflow.python import pywrap_tfe
  File "/Users/pkwang/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/pywrap_tfe.py", line 29, in <module>
    from tensorflow.python._pywrap_tfe import *
ImportError: dlopen(/Users/pkwang/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tfe.so, 2): Library not loaded: @rpath/_pywrap_tensorflow_internal.so
  Referenced from: /Users/pkwang/tensorflow_macos_venv/lib/python3.8/site-packages/tensorflow/python/_pywrap_tfe.so
  Reason: image not found
ghost commented 3 years ago

I tried to check the python version,but everything is normal:

 % file $(which python3)
/usr/bin/python3: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/python3 (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/python3 (for architecture arm64e): Mach-O 64-bit executable arm64e