pytorch dlopen image not found mac

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/username/Library/Python/3.8/lib/python3.8/site-packages/torch/__init__.py", line 84, in <module>
    from torch._C import *
ImportError: dlopen(/Users/username/Library/Python/3.8/lib/python3.8/site-packages/torch/_C.cpython-38-darwin.so, 9): Library not loaded: @rpath/libc++.1.dylib
  Referenced from: /Users/username/Library/Python/3.8/lib/python3.8/site-packages/torch/_C.cpython-38-darwin.so
  Reason: image not found

安裝運行pytorch之後報了一個上面的錯,找了很多方法,最後找到結果,參考:
https://discuss.pytorch.org/t/installation-problem-library-not-loaded-rpath-libc-1-dylib/36802

以下的so換成你自己的路徑

sudo install_name_tool -add_rpath /usr/lib /Users/username/Library/Python/3.8/lib/python3.8/site-packages/torch/_C.cpython-38-darwin.so

對我是有效的。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章