📄 99.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Robots" content="INDEX,NOFOLLOW">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<TITLE>Safari | Python Essential Reference, Second Edition -> Interpreter Options and Environment</TITLE>
<LINK REL="stylesheet" HREF="oreillyi/oreillyM.css">
</HEAD>
<BODY bgcolor="white" text="black" link="#990000" vlink="#990000" alink="#990000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellpadding=5 cellspacing=0 border=0 class="navtopbg"><tr><td><font size="1"><p class="navtitle"><a href="2.html" class="navtitle">Linux/Unix</a> > <a href="0735710910.html" class="navtitle">Python Essential Reference, Second Edition</a> > <a href="97.html" class="navtitle">10. Execution Environment</a> > <span class="nonavtitle">Interpreter Options and Environment</span></p></font></td><td align="right" valign="top" nowrap><font size="1"><a href="main.asp?list" class="safnavoff">See All Titles</a></font></td></tr></table>
<TABLE width=100% bgcolor=white border=0 cellspacing=0 cellpadding=5><TR><TD>
<TABLE border=0 width="100%" cellspacing=0 cellpadding=0><TR><td align=left width="15%" class="headingsubbarbg"><a href="98.html" title="10. Execution Environment"><font size="1">< BACK</font></a></td><td align=center width="70%" class="headingsubbarbg"><font size="1"><a href="popanote.asp?pubui=oreilly&bookname=0735710910&snode=99" target="_blank" title="Make a public or private annnotation">Make Note</a> | <a href="99.html" title="Use a Safari bookmark to remember this section">Bookmark</a></font></td><td align=right width="15%" class="headingsubbarbg"><a href="100.html" title="Interactive Sessions"><font size="1">CONTINUE ></font></a></td></TR></TABLE>
<a href="5%2F28%2F2002+9%3A03%3A50+PM.html" TABINDEX="-1"><img src=images/spacer.gif border=0 width=1 height=1></a><font color=white size=1>155117184014003188065099048180054212144238241179195140058238111161105085094121179040058246</font><a href="read0.asp?bookname=0735710910&snode=99&now=5%2F28%2F2002+9%3A03%3A50+PM" TABINDEX="-1"><img src=images/spacer.gif border=0 width=1 height=1></a><br>
<FONT>
<h3>Interpreter Options and Environment</h3>
<p>The interpreter has a number of options that control its runtime behavior and environment. On UNIX and Windows, options are given to the interpreter in the form of command-line options such as the following:</p>
<PRE>
python [<I>options</i>] [-c <i>cmd</i> | <i>filename</I> | - ] [<I>args</I>] </Pre>
<p>On the Macintosh, options to the Python interpreter are set using a separate program, <tT CLAss="monofont">EditPythonPrefs</tt>.</p>
<p>The following command-line options are available:</p>
<p><table border="1" cEllSpacIng="0" ceLlpaDDINg="1" widTH="100%">
<COlgroUP SPan="2">
<tr>
<TH VAlign="top">
<font size="2">
<p><b>Option</b></p>
</font></Th>
<tH valIgn="top">
<foNt siZE="2">
<P><B>Description</b></p>
</foNT></TH>
</tr>
<tr>
<TD VAlign="top">
<FONT size="2">
<p><tt class="monofont">-d</tt></p>
</font></tD>
<td ValiGn="top">
<fonT sizE="2">
<P>Generates parser debugging information.</P>
</Font></tD>
</TR>
<Tr>
<td vALIGn="top">
<fonT SIZe="2">
<p><tt class="monofont">-h</tt></p>
</font></td>
<td ValIgn="top">
<fOnt siZe="2">
<p>Prints a list of all available command-line options.</p>
</FONT></td>
</tr>
<TR>
<TD valiGN="top">
<FOnt siZE="2">
<P><Tt class="monofont">-i</tt></p>
</font></td>
<td valIgn="top">
<Font Size="2">
<p>Enters interactive mode after program execution.</P>
</fonT></TD>
</Tr>
<tr>
<tD VALign="top">
<fONT Size="2">
<p><TT CLass="monofont">-O</tt></p>
</font></td>
<td valign="top">
<FonT sizE="2">
<p>Optimized mode.</p>
</foNt></td>
</TR>
<TR>
<td vaLIGN="top">
<font SIZE="2">
<p><tt cLASS="monofont">-OO</tt></p>
</font></td>
<td valign="top">
<fonT siZe="2">
<p>Optimized mode plus removal of documentation strings.</p>
</Font></tD>
</tr>
<tR>
<TD ValigN="top">
<FONt sizE="2">
<P><TT clasS="monofont">-S</TT></P>
</font></td>
<td valign="top">
<font siZe="2">
<p>Prevents inclusion of the <Tt clAss="monofont">site</tt> initialization module.</P>
</fonT></TD>
</Tr>
<tr>
<tD VALign="top">
<fONT Size="2">
<p><TT CLass="monofont">-t</tt></p>
</font></td>
<td valign="top">
<FonT sizE="2">
<p>Reports warnings about inconsistent tab usage.</p>
</foNt></td>
</TR>
<TR>
<td vaLIGN="top">
<font SIZE="2">
<p><tt cLASS="monofont">-tt</tt></p>
</font></td>
<td valign="top">
<fonT siZe="2">
<p>Inconsistent tab usage results in a <tT clasS="monofont">TabError</tt> exception.</p>
</FONT></td>
</tr>
<TR>
<TD valiGN="top">
<FOnt siZE="2">
<P><Tt class="monofont">-u</tt></p>
</font></td>
<td valIgn="top">
<Font Size="2">
<p>Unbuffered binary <Tt clASS="monofont">stdout</Tt> and <tt cLASS="monofont">stdin</tt>.</p>
</fONT></Td>
</tr>
<tR>
<TD Valign="top">
<font size="2">
<p><tt clasS="monofont">-U</tt></P>
</fonT></td>
<td ValiGN="top">
<FOnt siZE="2">
<P>Unicode literals. All string literals are handled as Unicode.</P>
</font></TD>
</TR>
<tr>
<td VALIgn="top">
<font size="2">
<p><tt class="monofont">-v</tt></P>
</foNt></td>
<Td valIgn="top">
<fONT Size="2">
<p>Verbose mode.</P>
</FONt></td>
</tR>
<TR>
<Td valIGN="top">
<Font size="2">
<p><tt class="monofont">-V</tt></p>
</foNt></tD>
<td vAlign="top">
<Font SIZE="2">
<p>Prints the version number and exits.</p>
</foNT></TD>
</tr>
<tr>
<TD VAlign="top">
<FONT size="2">
<p><tt class="monofont">-x</tt></p>
</font></tD>
<td ValiGn="top">
<fonT sizE="2">
<P>Skips the first line of the source program.</P>
</Font></tD>
</TR>
<Tr>
<td vALIGn="top">
<fonT SIZe="2">
<p><tt class="monofont">-c </tt><i><tt class="monofont">cmd</tT></i>
</p>
</Font></Td>
<td vAligN="top">
<FONt sizE="2">
<P>Executes <I><Tt claSS="monofont">cmd</TT></i>
as a string.</p>
</foNT></TD>
</tr>
<tr>
<td valign="top">
<font size="2">
<P><tt ClasS="monofont">-</tt><i><tT claSS="monofont">Wfilter</TT></i>
</p>
</foNT></TD>
<td vaLIGN="top">
<font SIZE="2">
<p>Adds a warning filter.</p>
</font></td>
</tr>
</colgroup>
</taBle></P>
<p>The <tt Class="monofont">-d</Tt> option debugs the interpreter and is of limited use to most programmers. The <tt CLASs="monofont">-i option</tt> starts an interactive session immediately after a program has finished execution, and is useful for debugging. The <tT CLAss="monofont">-O</tt> and <TT CLass="monofont">-OO</tT> options apply some optimization to byte-compiled files, and are described in <A HRef="82.html">Chapter 8</a>, 揗odules and Packages.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -