如何运行 PythonTeX?

如何运行 PythonTeX?

我在运行 时遇到问题pythontex

我的平均能量损失如下:

\documentclass[12pt]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pythontex}

\begin{document}

\py{2+2}

\end{document}

这是日志档案

Command Line:   bibtex.exe "pyt"
Startup Folder: D:\Python TeX\pythontex-master\pythontex_quickstart

This is BibTeX, Version 0.99d (MiKTeX 2.9 64-bit)
The top-level auxiliary file: pyt.aux
I found no \citation commands---while reading file pyt.aux
I found no \bibdata command---while reading file pyt.aux
I found no \bibstyle command---while reading file pyt.aux
(There were 3 error messages)


Command Line:   texify.exe --pdf --tex-option=--interaction=errorstopmode "D:\Python TeX\pythontex-master\pythontex_quickstart\pyt.tex"
Startup Folder: D:\Python TeX\pythontex-master\pythontex_quickstart

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9 64-bit)
entering extended mode
("D:/Python TeX/pythontex-master/pythontex_quickstart/pyt.tex"
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 68 languages loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrartcl.cls"
Document Class: scrartcl 2013/12/19 v3.12 KOMA-Script document class (article)
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrkbase.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrbase.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrlfile.sty"
Package scrlfile, 2013/12/19 v3.12 KOMA-Script package (loading files)
                  Copyright (C) Markus Kohm

))) ("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\tocbasic.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrsize12pt.clo")
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\typearea.sty"
Package typearea, 2013/12/19 v3.12 KOMA-Script package (type area)
                  Copyright (C) Frank Neukam, 1992-1994
                  Copyright (C) Markus Kohm, 1994-

)) ("C:\Program Files\MiKTeX 2.9\tex\latex\base\fontenc.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\t1enc.def"))
("C:\Program Files\MiKTeX 2.9\tex\latex\base\inputenc.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\utf8.def"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\t1enc.dfu")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ot1enc.dfu")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\omsenc.dfu")))
("D:\Python TeX\pythontex-master\pythontex_quickstart\pythontex.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\fancyvrb\fancyvrb.sty"
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix 
<2008/02/07> (tvz)) ("C:\Program Files\MiKTeX 2.9\tex\latex\misc\etex.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\etoolbox\etoolbox.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\xstring\xstring.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\xstring\xstring.tex"))
("C:\Program Files\MiKTeX 2.9\tex\latex\pgfopts\pgfopts.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\pgf\utilities\pgfkeys.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\utilities\pgfkeys.code.tex"
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\utilities\pgfkeysfiltered.code.te
x")))) ("C:\Program Files\MiKTeX 2.9\tex\latex\caption\newfloat.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\currfile\currfile.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\kvoptions.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvsetkeys.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\etexcmds.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifluatex.sty"))))
("C:\Program Files\MiKTeX 2.9\tex\latex\filehook\filehook.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\filehook\filehook-scrlfile.sty")))
("C:\Program Files\MiKTeX 2.9\tex\latex\upquote\upquote.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\textcomp.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1enc.def"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1enc.dfu")))))
("D:\Python TeX\pythontex-master\pythontex_quickstart\pyt.aux")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1cmr.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\xcolor\xcolor.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\color.cfg")
("C:\Program Files\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
("C:\Program Files\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
)))
No file pythontex-files-pyt/pyt.pytxmcr.
Run PythonTeX to create it.

Package PythonTeX Warning: Missing autoprint content on input line 8.

[1{C:/ProgramData/MiKTeX/2.9/pdftex/config/pdftex.map}]
("D:\Python TeX\pythontex-master\pythontex_quickstart\pyt.aux") ){C:/Program Fi
les/MiKTeX 2.9/fonts/enc/dvips/cm-super/cm-super-t1.enc}<C:/Program Files/MiKTe
X 2.9/fonts/type1/public/cm-super/sfbx1200.pfb><C:/Program Files/MiKTeX 2.9/fon
ts/type1/public/cm-super/sfrm1200.pfb>
Output written on pyt.pdf (1 page, 5473 bytes).
Transcript written on pyt.log.


Command Line:   bibtex.exe "pyt"
Startup Folder: D:\Python TeX\pythontex-master\pythontex_quickstart

This is BibTeX, Version 0.99d (MiKTeX 2.9 64-bit)
The top-level auxiliary file: pyt.aux
I found no \citation commands---while reading file pyt.aux
I found no \bibdata command---while reading file pyt.aux
I found no \bibstyle command---while reading file pyt.aux
(There were 3 error messages)


Command Line:   texify.exe --pdf --tex-option=--interaction=errorstopmode "D:\Python TeX\pythontex-master\pythontex_quickstart\pyt.tex"
Startup Folder: D:\Python TeX\pythontex-master\pythontex_quickstart

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9 64-bit)
entering extended mode
("D:/Python TeX/pythontex-master/pythontex_quickstart/pyt.tex"
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 68 languages loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrartcl.cls"
Document Class: scrartcl 2013/12/19 v3.12 KOMA-Script document class (article)
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrkbase.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrbase.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrlfile.sty"
Package scrlfile, 2013/12/19 v3.12 KOMA-Script package (loading files)
                  Copyright (C) Markus Kohm

))) ("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\tocbasic.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrsize12pt.clo")
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\typearea.sty"
Package typearea, 2013/12/19 v3.12 KOMA-Script package (type area)
                  Copyright (C) Frank Neukam, 1992-1994
                  Copyright (C) Markus Kohm, 1994-

)) ("C:\Program Files\MiKTeX 2.9\tex\latex\base\fontenc.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\t1enc.def"))
("C:\Program Files\MiKTeX 2.9\tex\latex\base\inputenc.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\utf8.def"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\t1enc.dfu")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ot1enc.dfu")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\omsenc.dfu")))
("D:\Python TeX\pythontex-master\pythontex_quickstart\pythontex.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\fancyvrb\fancyvrb.sty"
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix 
<2008/02/07> (tvz)) ("C:\Program Files\MiKTeX 2.9\tex\latex\misc\etex.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\etoolbox\etoolbox.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\xstring\xstring.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\xstring\xstring.tex"))
("C:\Program Files\MiKTeX 2.9\tex\latex\pgfopts\pgfopts.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\pgf\utilities\pgfkeys.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\utilities\pgfkeys.code.tex"
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\utilities\pgfkeysfiltered.code.te
x")))) ("C:\Program Files\MiKTeX 2.9\tex\latex\caption\newfloat.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\currfile\currfile.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\kvoptions.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvsetkeys.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\etexcmds.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifluatex.sty"))))
("C:\Program Files\MiKTeX 2.9\tex\latex\filehook\filehook.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\filehook\filehook-scrlfile.sty")))
("C:\Program Files\MiKTeX 2.9\tex\latex\upquote\upquote.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\textcomp.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1enc.def"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1enc.dfu")))))
("D:\Python TeX\pythontex-master\pythontex_quickstart\pyt.aux")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1cmr.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\xcolor\xcolor.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\color.cfg")
("C:\Program Files\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
("C:\Program Files\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
)))
No file pythontex-files-pyt/pyt.pytxmcr.
Run PythonTeX to create it.

Package PythonTeX Warning: Missing autoprint content on input line 8.

[1{C:/ProgramData/MiKTeX/2.9/pdftex/config/pdftex.map}]
("D:\Python TeX\pythontex-master\pythontex_quickstart\pyt.aux") ){C:/Program Fi
les/MiKTeX 2.9/fonts/enc/dvips/cm-super/cm-super-t1.enc}<C:/Program Files/MiKTe
X 2.9/fonts/type1/public/cm-super/sfbx1200.pfb><C:/Program Files/MiKTeX 2.9/fon
ts/type1/public/cm-super/sfrm1200.pfb>
Output written on pyt.pdf (1 page, 5473 bytes).
Transcript written on pyt.log.


Command Line:   bibtex.exe "pyt"
Startup Folder: D:\Python TeX\pythontex-master\pythontex_quickstart

This is BibTeX, Version 0.99d (MiKTeX 2.9 64-bit)
The top-level auxiliary file: pyt.aux
I found no \citation commands---while reading file pyt.aux
I found no \bibdata command---while reading file pyt.aux
I found no \bibstyle command---while reading file pyt.aux
(There were 3 error messages)


Command Line:   texify.exe --pdf --tex-option=--interaction=errorstopmode "D:\Python TeX\pythontex-master\pythontex_quickstart\pyt.tex"
Startup Folder: D:\Python TeX\pythontex-master\pythontex_quickstart

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9 64-bit)
entering extended mode
("D:/Python TeX/pythontex-master/pythontex_quickstart/pyt.tex"
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 68 languages loaded.
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrartcl.cls"
Document Class: scrartcl 2013/12/19 v3.12 KOMA-Script document class (article)
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrkbase.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrbase.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrlfile.sty"
Package scrlfile, 2013/12/19 v3.12 KOMA-Script package (loading files)
                  Copyright (C) Markus Kohm

))) ("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\tocbasic.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\scrsize12pt.clo")
("C:\Program Files\MiKTeX 2.9\tex\latex\koma-script\typearea.sty"
Package typearea, 2013/12/19 v3.12 KOMA-Script package (type area)
                  Copyright (C) Frank Neukam, 1992-1994
                  Copyright (C) Markus Kohm, 1994-

)) ("C:\Program Files\MiKTeX 2.9\tex\latex\base\fontenc.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\t1enc.def"))
("C:\Program Files\MiKTeX 2.9\tex\latex\base\inputenc.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\utf8.def"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\t1enc.dfu")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ot1enc.dfu")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\omsenc.dfu")))
("D:\Python TeX\pythontex-master\pythontex_quickstart\pythontex.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\fancyvrb\fancyvrb.sty"
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix 
<2008/02/07> (tvz)) ("C:\Program Files\MiKTeX 2.9\tex\latex\misc\etex.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\etoolbox\etoolbox.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\xstring\xstring.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\xstring\xstring.tex"))
("C:\Program Files\MiKTeX 2.9\tex\latex\pgfopts\pgfopts.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\pgf\utilities\pgfkeys.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\utilities\pgfkeys.code.tex"
("C:\Program Files\MiKTeX 2.9\tex\generic\pgf\utilities\pgfkeysfiltered.code.te
x")))) ("C:\Program Files\MiKTeX 2.9\tex\latex\caption\newfloat.sty")
("C:\Program Files\MiKTeX 2.9\tex\latex\currfile\currfile.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\oberdiek\kvoptions.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ltxcmds.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\kvsetkeys.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\infwarerr.sty")
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\etexcmds.sty"
("C:\Program Files\MiKTeX 2.9\tex\generic\oberdiek\ifluatex.sty"))))
("C:\Program Files\MiKTeX 2.9\tex\latex\filehook\filehook.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\filehook\filehook-scrlfile.sty")))
("C:\Program Files\MiKTeX 2.9\tex\latex\upquote\upquote.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\textcomp.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1enc.def"
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1enc.dfu")))))
("D:\Python TeX\pythontex-master\pythontex_quickstart\pyt.aux")
("C:\Program Files\MiKTeX 2.9\tex\latex\base\ts1cmr.fd")
("C:\Program Files\MiKTeX 2.9\tex\latex\xcolor\xcolor.sty"
("C:\Program Files\MiKTeX 2.9\tex\latex\00miktex\color.cfg")
("C:\Program Files\MiKTeX 2.9\tex\latex\pdftex-def\pdftex.def"
("C:\Program Files\MiKTeX 2.9\tex\context\base\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
)))
No file pythontex-files-pyt/pyt.pytxmcr.
Run PythonTeX to create it.

Package PythonTeX Warning: Missing autoprint content on input line 8.

[1{C:/ProgramData/MiKTeX/2.9/pdftex/config/pdftex.map}]
("D:\Python TeX\pythontex-master\pythontex_quickstart\pyt.aux") ){C:/Program Fi
les/MiKTeX 2.9/fonts/enc/dvips/cm-super/cm-super-t1.enc}<C:/Program Files/MiKTe
X 2.9/fonts/type1/public/cm-super/sfbx1200.pfb><C:/Program Files/MiKTeX 2.9/fon
ts/type1/public/cm-super/sfrm1200.pfb>
Output written on pyt.pdf (1 page, 5473 bytes).
Transcript written on pyt.log.


_____________________________________________________________________

 PDFTeXify Compilation Report (Pages: 1)

 Errors: 0   Warnings: 2   Bad Boxes: 0
_____________________________________________________________________

我得到了pdf 文件像这样:

跑步

我正在用编译我的文件,pdflatex但我不知道如何运行pythontex。有什么建议吗?

答案1

将我的旧评论转换为答案以供将来参考:每当需要执行代码时,您都需要运行 LaTeX,然后pythontex.py,然后再次运行 LaTeX。如果不需要执行代码,您可以直接运行 LaTeX。如果您pythontex使用pythontex_install.py脚本或 TeX 发行版的包管理器进行安装,则可能已经存在快捷方式pythontex.py。您可以通过在命令行上运行来检查这一点pythontex --version。如果存在快捷方式,则运行pythontex非常简单pythontex <name_of_tex_file>

答案2

G. Poore 是正确的,但他仍然忽略了一些东西。

当您打开cmd提示并输入时,请确保您在存储文件pythontex [name_of_tex_file]的目录中执行此操作。tex

也就是说,首先在 cmd 提示符中输入:cd [directory_where_your_tex_file_is_stored]然后点击enter,然后输入:pythontex [name_of_tex_file]否则会给出错误:无法找到。成功编译文件[name_of_tex_file]后,在 TeXMaker 或您使用的任何编辑器中重新运行它。pythontextextex

相关内容