使用如下命令安装pytorch:
pip3 install torch torchvision
安装成功后导入模块失败:
>>> import torch
Traceback (most recent call last):
File "", line 1, in
File "/Users/chao/.pyenv/versions/3.6.2/lib/python3.6/site-packages/torch/__init__.py", line 79, in
from torch._C import *
ImportError: dlopen(/Users/chao/.pyenv/versions/3.6.2/lib/python3.6/site-packages/torch/_C.cpython-36m-darwin.so, 9): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib
Referenced from: /Users/chao/.pyenv/versions/3.6.2/lib/python3.6/site-packages/torch/lib/libshm.dylib
Reason: image not found
brew install libomp