Python:vscode中运行%matlabplot inline语句出错 | 您所在的位置:网站首页 › inline怎么用在MATLAB中 › Python:vscode中运行%matlabplot inline语句出错 |
在vscode环境中运行关于概率编程的一段Python示例代码,其中有一句:%matlabplot inline,报的错误如下: File "d:/work/PPL/infer1.py", line 8 %matlabplot inline ^ SyntaxError: invalid syntax 在查阅网上相关资料之后发现,这是在Iphython中使用的magic命令,作用是将画图在前端执行。我的vscode环境中配置的是标准的Python解释器,所以这语句是不能运行的。Ipython相关介绍见:https://blog.csdn.net/gavin_john/article/details/53086766 如果要运行,需要将这段代码注释掉,同时在画图的相关命令之后,要加入plt.show(),否则画的图是不会显示的。 参考文章: [1]:https://blog.csdn.net/HIsckey/article/details/85126647 [2]:https://blog.csdn.net/C_tommy/article/details/83184382 [3]:https://blog.csdn.net/liangzuojiayi/article/details/78183783
|
CopyRight 2018-2019 实验室设备网 版权所有 |