Pweave模块无法生成图片

2024-06-25 22:40:34 发布

您现在位置:Python中文网/ 问答频道 /正文

最近从R转换到Python之后,我正在探索Pweave作为swave的替代品。示例文件(http://mpastell.com/pweave/examples/index.html)看起来很不错,所以我已经开始构建这些文件。使用命令

pweave-f tex FIR_设计_动词.texw在

从终端生成一个.tex文件,然后可以转换成包含图形的pdf文件。在

从python解释器(在我的例子中是spyder)中尝试与

import pweave pweave.weave('FIR_design_verb.texw', doctype = "tex")

结果不一样。生成的tex文件具有

\begin{figure}[htpb] \center \caption{Test!} \label{fig:None} \end{figure}

缺少\includegraphics{},figures文件夹已创建但为空。我是否缺少参数p编织()? 在

Ps:作为一种解决方案,以下代码有效:

import subprocess cmd = ['pweave', '-f', 'tex', 'pweave_test.texw'] proc = subprocess.Popen(cmd) proc.communicate()


Tags: 文件importcmdhttp替代品示例proctex
1条回答
网友
1楼 · 发布于 2024-06-25 22:40:34

我认为问题在于Spyder在Pweave之前导入了ˋmatplotlibˋ,因此没有捕捉到数据。如果运行“纯”python解释器,代码应该可以工作。在

相关问题 更多 >