我正在使用课程中的代码来显示一个带有一些参数m、s和logN作为交互式滑块的函数。然而,虽然它们在其他机器上显示,但在我的(MacMini m1)上却不显示,我也不知道为什么,但考虑到我在安装ipywidget时遇到了很多问题,我认为它更多的是与软件有关。

从本质上讲,我只能看不到这三个滑块,但绘图看起来是一样的。
代码如下:
def f1(m,s,logN):
#mu, sigma, N = 0.5, 0.25, 10000 # mean and standard deviation
x = np.random.normal(m, s, 10**logN)
g=sns.distplot(x, hist_kws=dict(cumulative=True),
kde_kws=dict(cumulative=True))
g.set(xlim=(-15,25))
plt.show()
np.mean(x), np.sqrt(np.var(x))
interactive_plot = interactive(f1, m=(0.0, 10, 1), s=(1,10.0,1),
logN=(1,5,1))
output = interactive_plot.children[-1]
output.layout.width = '600px'
interactive_plot发布于 2021-11-21 16:13:22
我在一个相关的问题中找到了答案(完全归功于this post)。基本上,以管理员身份运行conda install -c conda-forge ipywidgets,扩展将卸载并得到验证。
https://stackoverflow.com/questions/70056220
复制相似问题