📄 230.html
字号:
<P>Define the compiler and system options for the building process. You need to type the following command. Note that optionally, you can enable the threading option by passing the argument <TT Class="monofont">--with-thread</TT> to the <TT clasS="monofont">configure</TT> command. Also, you might want to enable floating point exception support by passing the argument <Tt claSS="monofont">--enable-fpectl</TT>.</p>
<pre>
./configure
</pre>
</li>
<li>
<p>Copy the <tt class="monofont">Modules/Setup.in</tT> file to the subdirectory <tt ClasS="monofont">Modules/Setup.</tt>
</p>
</lI>
<li>
<p>In order to enable the <A NAMe="idx1073749954"></a>
<a nAME="idx1073749955"></A>
<a namE="idx1073749956"></A>
<A Name="idx1073749957"></a>Tkinter module (because it is not enabled by default), you need to modify this file. This file is responsible for deciding the built-in modules that must be built along with Python. Modifying this file is not difficult, as you can see next. The following piece of file code shows where you need to change in order to enable Tkinter. This example shows what you might want to uncomment because it can vary for different UNIX systems (what you see here should be fine for most systems though).</P>
<PRE>
# The _tkinter module.
#
# The TKPATH variable is always enabled, to save you the effort.
TKPATH=:lib-tk
# The command for _tkinter is long and site specific. Please
# uncomment and/or edit those parts as indicated. If you don't have a
# specific extension (e.g. Tix or BLT), leave the corresponding line
# commented out. (Leave the trailing backslashes in! If you
# experience strange errors, you may want to join all uncommented
# lines and remove the backslashes -- the backslash interpretation is
# done by the shell's "read" command and it may not be implemented on
# every system.
#***Always uncomment this (leave the leading underscore in!):
_tkinter _tkinter.c tkappinit.c -DWITH_APPINIT \
#***Uncomment and edit to reflect where your Tcl/Tk headers are:
-I/usr/local/include \
#***Uncomment and edit to reflect where your X11 header files are:
-I/usr/X11R6/include \
#***Or uncomment this for Solaris:
# -I/usr/openwin/include \
#***Uncomment and edit for Tix extension only:
# -DWITH_TIX -ltix4.1.8.0 \
#***Uncomment and edit for BLT extension only:
# -DWITH_BLT -I/usr/local/blt/blt8.0-unoff/include -lBLT8.0 \
#***Uncomment and edit for PIL (TkImaging) extension only:
# -DWITH_PIL -I../Extensions/Imaging/libImaging tkImaging.c \
#***Uncomment and edit for TOGL extension only:
# -DWITH_TOGL togl.c \
#***Uncomment and edit to reflect where your Tcl/Tk libraries are:
-L/usr/local/lib \
#***Uncomment and edit to reflect your Tcl/Tk versions:
-ltk8.0 -ltcl8.0 \
#***Uncomment and edit to reflect where your X11 libraries are:
-L/usr/X11R6/lib \
#***Or uncomment this for Solaris:
# -L/usr/openwin/lib \
#***Uncomment these for TOGL extension only:
# -lGL -lGLU -lXext -lXmu \
#***Uncomment for AIX:
# -lld \
#***Always uncomment this; X11 libraries to link with:
-lX11
</pre>
</li>
<li>
<p>Optionally, you can choose for <a name="idx1073749958"></a>
<a name="idx1073749959"></a>
<A naMe="idx1073749960"></a>
<a Name="idx1073749961"></a>
<A namE="idx1073749962"></A>building the modules as shared libraries. It is a good idea to build shared libraries because it will decrease the size of the Python binary, reduce the number of libraries it is linked to, and probably reduce its memory consumption. You need to look for the following lines in the <TT clasS="monofont">Setup.in</TT> file, and make the small change that is indicated there.</P>
<pre>
# Uncommenting the following line tells makesetup that all following
# modules are to be built as shared libraries (see above for more
# detail; also note that *static* reverses this effect):
#*shared*
</pRE>
<DIv claSS="note"><P Class="notetitle"><b>Note</b></p><p>
<p>Note that you can uncomment lines for other modules you want to build, as well.</p>
</p></div>
<br>
<br>
</li>
<Li>
<p>Now, you just have to run the utility commands that creates and installs the Python executable and library files.</P>
<pre>
make
make install
</Pre>
</li>
<Li>
<p>Finally, sometimes you need to set up the environment variables: <tT CLAss="monofont">PATH,</tt>
<TT CLass="monofont">PYTHONPATH,</tT>
<TT Class="monofont">TCL_LIBRARY,</TT> and <TT class="monofont">TK_LIBRARY</tt> to the correct values. In most cases, this shouldn't be necessary because the programs are installed where they expect to be installed. Possibly having to add <tt class="monofont">/usr/local/bin</tt> to <tt clAss="monofont">PATH</Tt> is probably all that is needed.<a nAme="idx1073749963"></a>
<a Name="idx1073749964"></A>
<A NAme="idx1073749965"></a>
<a NAME="idx1073749966"></a>
<a naME="idx1073749967"></A>
<A name="idx1073749968"></A>
<A NAme="idx1073749969"></a>
</p>
</li>
</ol>
</font>
<P><TABLE width="100%" border=0><TR valign="top"><TD><font size=1 color="#C0C0C0"><br></font></TD><TD align=right><font size=1 color="#C0C0C0">Last updated on 1/30/2002<br>Python Developer's Handbook, © 2002 Sams Publishing</font></TD></TR></TABLE></P>
<TABLE border=0 width="100%" cellspacing=0 cellpadding=0><TR><td align=left width="15%" class="headingsubbarbg"><a href="229.html" title="The Development Process of Python Programs"><font size="1">< BACK</font></a></td><td align=center width="70%" class="headingsubbarbg"><font size="1"><a href="popanote.asp?pubui=oreilly&bookname=0672319942&snode=230" target="_blank" title="Make a public or private annnotation">Make Note</a> | <a href="230.html" title="Use a Safari bookmark to remember this section">Bookmark</a></font></td><td align=right width="15%" class="headingsubbarbg"><a href="231.html" title="Editing Code"><font size="1">CONTINUE ></font></a></td></TR></TABLE>
</TD></TR></TABLE>
<br><TABLE width=100% bgcolor=white border=0 cellspacing=0 cellpadding=5><TR><TD><H4 class=Title>Index terms contained in this section</H4>
<font size=2>
<a href="#idx1073749926">/PCbuild directory</a><BR>
<a href="#idx1073749950">/usr/local directory</a><BR>
applications<BR>
source code<BR>
<a href="#idx1073749923">compiling</a> <a href="#idx1073749935">2nd</a> <a href="#idx1073749966">3rd</a><BR>
Build menu<BR>
<a href="#idx1073749930">Debug option</a><BR>
building<BR>
<a href="#idx1073749958">modules as shared libraries</a><BR>
code<BR>
source<BR>
<a href="#idx1073749922">compiling</a> <a href="#idx1073749934">2nd</a> <a href="#idx1073749965">3rd</a><BR>
compiling<BR>
<a href="#idx1073749920">source code</a> <a href="#idx1073749932">2nd</a> <a href="#idx1073749963">3rd</a><BR>
<a href="#idx1073749915">config.c file</a><BR>
<a href="#idx1073749913">config.h file</a><BR>
creating<BR>
<a href="#idx1073749962">modules as shared libraries</a><BR>
Debug option<BR>
<a href="#idx1073749928">Build menu</a><BR>
directories<BR>
<a href="#idx1073749927">/PCbuild</a><BR>
<a href="#idx1073749951">/usr/local</a><BR>
<a href="#idx1073749941">dl_nt.c file</a><BR>
<a href="#idx1073749947">dllbase_nt.txt file</a><BR>
enabling<BR>
<a href="#idx1073749957">Tkinter module</a><BR>
<a href="#idx1073749948">example_nt subdirectory</a><BR>
files<BR>
<a href="#idx1073749914">config.c</a><BR>
<a href="#idx1073749912">config.h</a><BR>
<a href="#idx1073749940">dl_nt.c</a><BR>
<a href="#idx1073749946">dllbase_nt.txt</a><BR>
<a href="#idx1073749944">getpathp.c</a><BR>
<a href="#idx1073749942">import_nt.c</a><BR>
<a href="#idx1073749910">project</a><BR>
<a href="#idx1073749938">python_nt.rc</a><BR>
<a href="#idx1073749916">testpy.py</a><BR>
<a href="#idx1073749945">getpathp.c file</a><BR>
<a href="#idx1073749943">import_nt.c file</a><BR>
libraries<BR>
shared<BR>
<a href="#idx1073749961">building modules as</a><BR>
menus<BR>
Build<BR>
<a href="#idx1073749929">Debug option</a><BR>
modules<BR>
<a href="#idx1073749959">building as shared libraries</a><BR>
<a href="#idx1073749953">Tkinter</a> <a href="#idx1073749955">2nd</a><BR>
ports<BR>
<a href="#idx1073749919">testing</a><BR>
programs<BR>
source code<BR>
<a href="#idx1073749924">compiling</a> <a href="#idx1073749936">2nd</a> <a href="#idx1073749967">3rd</a><BR>
<a href="#idx1073749911">project file</a><BR>
<a href="#idx1073749939">python_nt.rc file</a><BR>
shared libraries<BR>
<a href="#idx1073749960">building modules as</a><BR>
software<BR>
source code<BR>
<a href="#idx1073749925">compiling</a> <a href="#idx1073749937">2nd</a> <a href="#idx1073749968">3rd</a><BR>
source code<BR>
<a href="#idx1073749921">compiling</a> <a href="#idx1073749933">2nd</a> <a href="#idx1073749964">3rd</a><BR>
subdirectories<BR>
<a href="#idx1073749949">example_nt</a><BR>
<a href="#idx1073749931">subprojects</a><BR>
testing<BR>
<a href="#idx1073749918">ports</a><BR>
<a href="#idx1073749917">testpy.py file</a><BR>
<a href="#idx1073749952">Tkinter module</a> <a href="#idx1073749954">2nd</a><BR>
turning on<BR>
<a href="#idx1073749956">Tkinter module</a><BR>
UNIX<BR>
compiling<BR>
<a href="#idx1073749969">source code</a><BR>
<BR>
</font></TD></TR></TABLE>
<!--EndOfBrowse-->
</TD></TR></TABLE>
<table width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=#990000><tr><td><p align=center><font size=1 face="verdana,arial,helvetica" color=white>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -