When ‘import torch’ in Python3, it shows the following problem:
Python 3.7.5rc1 (default, Oct 2 2019, 04:19:31)
[GCC 9.2.1 20190909] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/python3.7/lib/python3.7/site-packages/torch/__init__.py", line 81, in <module>
from torch._C import *
ImportError: /opt/python3.7/lib/python3.7/site-packages/torch/lib/libtorch_python.so: undefined symbol: _ZTIN5torch8autograd4NodeE
>>>
After updating Python3.7 and reinstalling PyTorch, the error persists:
Python 3.7.5 (default, Oct 27 2019, 15:43:29)
[GCC 9.2.1 20191022] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/python3.7/lib/python3.7/site-packages/torch/__init__.py", line 81, in <module>
from torch._C import *
ImportError: /opt/python3.7/lib/python3.7/site-packages/torch/lib/libtorch_python.so: undefined symbol: _ZTIN5torch8autograd4NodeE
>>>