I'm trying to run the following code:
import matplotlib.pyplot as plt
%matplotlib inline
import torch
x = y = torch.tensor([1,2,3]).numpy()
plt.plot(x,y);
I keep getting the message: The kernel appears to have died. It will restart automatically.
The kernel appears to have died. It will restart automatically.
and a restart and a red "Dead kernel" tag on the toolbar.
But the weird thing is, if I import matplotlib.pyplot
and plot some random graph first, the above code plots just fine. In other words, the following code works fine.
import matplotlib.pyplot as plt
%matplotlib inline
plt.subplots(figsize=(0.01,0.01))
plt.gca().set_visible(False);
import torch
x = torch.tensor([1,2,3]).numpy()
plt.plot(x,x);
What is going on here? I'm using numpy 1.18.5, pytorch 1.6.0, matplotlib 3.2.2 on Python 3.7.7, if it matters. Thank you.
import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"
Run this first, then it'll resolve your problem. Although I guess, it is a temporary solution you can refer to this link: https://www.programmersought.com/article/53286415201/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.