Pytorch ImportError报错解决方法
程序员文章站
2022-05-08 22:17:45
...
系统环境:Mac Pro
程序环境:python 3.7
- 刚刚安装完torch后,运行提示缺少
from torch._C import *
错误信息
Traceback (most recent call last):
File "/Users/haibei/Documents/Airly/new-pollution-forecast/Datasets/__init__.py", line 3, in <module>
from torch.utils.data import Dataset
File "/Users/kaspersapala/.local/share/virtualenvs/new-pollution-forecast-BSetKF9E/lib/python3.7/site-packages/torch/__init__.py", line 79, in <module>
from torch._C import *
ImportError: dlopen(/Users/haibei/.local/share/virtualenvs/new-pollution-forecast-BSetKF9E/lib/python3.7/site-packages/torch/_C.cpython-37m-darwin.so, 9): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib
Referenced from: /Users/kaspersapala/.local/share/virtualenvs/new-pollution-forecast-BSetKF9E/lib/python3.7/site-packages/torch/lib/libshm.dylib
Reason: image not found
解决方法
- 需要安装libomp,不知道是干啥的,好像跟C的编译器有关系
brew install libomp
推荐阅读
-
编译PHP报错configure error Cannot find libmysqlclient under usr的解决方法
-
Visual studio 2017添加引用时报错未能正确加载ReferenceManagerPackage包的解决方法
-
Python运行报错UnicodeDecodeError的解决方法
-
sudo service: command not found 报错的解决方法
-
vuex2中使用mapGetters/mapActions报错的解决方法
-
mysql报错1033 Incorrect information in file: ‘xxx.frm’问题的解决方法
-
PHP执行Curl时报错提示CURL ERROR: Recv failure: Connection reset by peer的解决方法
-
windows10使用IE11浏览器出现已停止工作报错的解决方法
-
VS2017添加EF的MVC控制器报错的解决方法
-
json解析时遇到英文双引号报错的解决方法