运行 Julia 代码时未显示 ProfileView 图

ProfileView plot not showing when running Julia Code

我想在 Julia 中分析我的代码,我安装了包“ProfileView.jl”。但是,当我 运行 代码时 windows 弹出一秒钟并立即关闭。

我有 运行 来自 VS Code 和终端的脚本。我正在分析的代码是:

using ProfileView
@profview Mesh,MatPointData, AnalysisConstants = setupfunc(T)

一般来说,您应该在 REPL 中以交互方式 运行 ProfileView,而不是作为脚本的一部分。如果你正在使用 VSCode,你想启动 Julia REPL(Ctrl-Shift-P 然后 Julia: Start REPL);从终端,您想 运行 一个交互式会话,即 $ julia 而不是 $ julia somescript.jl.

如果您只是必须使用脚本(同样,不推荐,因为您将无法访问 ProfileView 中一些不错的交互功能),请参阅 https://juliagraphics.github.io/Gtk.jl/latest/manual/nonreplusage/