mac-pytorch报错:packages/torch/__init__.py", line 79, in from torch._C import *

Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/a/Documents/develop/anaconda2/lib/python2.7/site-packages/torch/__init__.py", line 79, in 
    from torch._C import *
ImportError: dlopen(/Users/a/Documents/develop/anaconda2/lib/python2.7/site-packages/torch/_C.so, 9): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib
  Referenced from: /Users/a/Documents/develop/anaconda2/lib/python2.7/site-packages/torch/lib/libshm.dylib
  Reason: image not found

今天安装pytorch,报如上错误,使用的是如下命令

sudo pip install torch torchvision

后来在mac上安装了如下包就可以import torch了

pip install intel-openmp

brew install libomp

 

你可能感兴趣的:(报错)