The
problem occurs when using import torch.
is a very weird problem that has been discussed a lot on github, but there is no fundamental solution, and it is not just a problem with torch, but also with tensorflow.
solution:
1, switch the order of the call package, for example:
import cv2
import torch # 报错
# different order
import torch
import cv2 # ok
2. However, the above method does not work for me:
p>
reference: https://github.com/pytorch/pytorch/issues/2083
using the old brother’s method, which still makes no sense, but it works for me