forked from joshgachnang/diveintopython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathredhat.html
More file actions
129 lines (125 loc) · 10.4 KB
/
redhat.html
File metadata and controls
129 lines (125 loc) · 10.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>1.5. Python on RedHat Linux</title>
<link rel="stylesheet" href="/css/diveintopython.css" type="text/css" />
<link rev="made" href="josh@servercobra.com" />
<meta name="generator" content="DocBook XSL Stylesheets V1.52.2" />
<meta name="keywords" content="Python, Dive Into Python, tutorial, object-oriented, programming, documentation, book, free" />
<meta name="description" content="Python from novice to pro" />
<link rel="home" href="http://www.diveintopython.net/" title="Dive Into Python" />
<link rel="up" href="http://www.diveintopython.net/" title="Chapter 1. Installing Python" />
<link rel="previous" href="http://www.diveintopython.net/" title="1.4. Python on Mac OS 9" />
<link rel="next" href="http://www.diveintopython.net/" title="1.6. Python on Debian GNU/Linux" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-9740779-18']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script></head>
<body>
<style type="text/css">body{margin-top:0!important;padding-top:0!important;min-width:800px!important;}#wm-ipp a:hover{text-decoration:underline!important;}</style>
<table id="Header" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
<tr>
<td id="breadcrumb" colspan="5" align="left" valign="top">You are here: <a href="http://www.diveintopython.net/index.html">Home</a> > <a href="http://www.diveintopython.net/toc/index.html">Dive Into Python</a> > <a href="http://www.diveintopython.net/installing_python/index.html">Installing Python</a> > <span class="thispage">Python on RedHat Linux</span></td>
<td id="navigation" align="right" valign="top"> <a href="http://www.diveintopython.net/installing_python/macos9.html" title="Prev: “Python on Mac OS 9”"><<</a> <a href="http://www.diveintopython.net/installing_python/debian.html" title="Next: “Python on Debian GNU/Linux”">>></a></td>
</tr>
<tr>
<td colspan="3" id="logocontainer">
<h1 id="logo"><a href="http://www.diveintopython.net/index.html" accesskey="1">Dive Into Python</a></h1>
<p id="tagline">Python from novice to pro</p>
</td>
<td colspan="3" align="right">
<form id="search" method="GET" action="http://www.google.com/custom">
<p><label for="q" accesskey="4">Find: </label><input type="text" id="q" name="q" size="20" maxlength="255" value=" " /> <input type="submit" value="Search" /><input type="hidden" name="cof" value="LW:752;L:http://diveintopython.org/images/diveintopython.png;LH:42;AH:left;GL:0;AWFID:3ced2bb1f7f1b212;" /><input type="hidden" name="domains" value="diveintopython.org" /><input type="hidden" name="sitesearch" value="diveintopython.org" /></p>
</form>
</td>
</tr>
</table>
<div class="section" lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title"><a name="install.redhat"></a>1.5. <span class="application">Python</span> on RedHat Linux
</h2>
</div>
</div>
<div></div>
</div>
<p>Installing under UNIX-compatible operating systems such as Linux is easy if you're willing to install a binary package. Pre-built
binary packages are available for most popular Linux distributions. Or you can always compile from source.
</p>
<div class="abstract">
<p>Download the latest <span class="application">Python</span> <span class="acronym">RPM</span> by going to <a href="http://www.diveintopython.net/ftp/python/">http://www.python.org/ftp/python/</a> and selecting the highest version number listed, then selecting the <tt class="filename">rpms/</tt> directory within that. Then download the <span class="acronym">RPM</span> with the highest version number. You can install it with the <span><b class="command">rpm</b></span> command, as shown here:
</p>
</div>
<div class="example"><a name="d0e3510"></a><h3 class="title">Example 1.2. Installing on RedHat Linux 9</h3><pre class="screen">
<tt class="prompt">localhost:~$ </tt><span class="userinput">su -</span>
<tt class="prompt">Password: </tt><span class="userinput">[enter your root password]</span>
<tt class="prompt">[root@localhost root]# </tt><span class="userinput">wget http://python.org/ftp/python/2.3/rpms/redhat-9/python2.3-2.3-5pydotorg.i386.rpm</span>
<span class="computeroutput">Resolving python.org... done.
Connecting to python.org[194.109.137.226]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7,495,111 [application/octet-stream]
...</span>
<tt class="prompt">[root@localhost root]# </tt><span class="userinput">rpm -Uvh python2.3-2.3-5pydotorg.i386.rpm</span>
<span class="computeroutput">Preparing... ########################################### [100%]
1:python2.3 ########################################### [100%]</span>
<tt class="prompt">[root@localhost root]# </tt><span class="userinput">python</span> <a name="install.unix.1.1"></a><img src="http://www.diveintopython.net/images/callouts/1.png" alt="1" border="0" width="12" height="12" />
<span class="computeroutput">Python 2.2.2 (#1, Feb 24 2003, 19:13:11)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2
Type "help", "copyright", "credits", or "license" for more information.</span>
<tt class="prompt">>>> </tt><span class="userinput">[press Ctrl+D to exit]</span>
<tt class="prompt">[root@localhost root]# </tt><span class="userinput">python2.3</span> <a name="install.unix.1.2"></a><img src="http://www.diveintopython.net/images/callouts/2.png" alt="2" border="0" width="12" height="12" />
<span class="computeroutput">Python 2.3 (#1, Sep 12 2003, 10:53:56)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits", or "license" for more information.</span>
<tt class="prompt">>>> </tt><span class="userinput">[press Ctrl+D to exit]</span>
<tt class="prompt">[root@localhost root]# </tt><span class="userinput">which python2.3</span> <a name="install.unix.1.3"></a><img src="http://www.diveintopython.net/images/callouts/3.png" alt="3" border="0" width="12" height="12" />
<span class="computeroutput">/usr/bin/python2.3</span>
</pre><div class="calloutlist">
<table border="0" summary="Callout list">
<tr>
<td width="12" valign="top" align="left"><a href="http://www.diveintopython.net/installing_python/redhat.html#install.unix.1.1"><img src="http://www.diveintopython.net/images/callouts/1.png" alt="1" border="0" width="12" height="12" /></a>
</td>
<td valign="top" align="left">Whoops! Just typing <b class="userinput"><tt>python</tt></b> gives you the older version of <span class="application">Python</span> -- the one that was installed by default. That's not the one you want.
</td>
</tr>
<tr>
<td width="12" valign="top" align="left"><a href="http://www.diveintopython.net/installing_python/redhat.html#install.unix.1.2"><img src="http://www.diveintopython.net/images/callouts/2.png" alt="2" border="0" width="12" height="12" /></a>
</td>
<td valign="top" align="left">At the time of this writing, the newest version is called <b class="userinput"><tt>python2.3</tt></b>. You'll probably want to change the path on the first line of the sample scripts to point to the newer version.
</td>
</tr>
<tr>
<td width="12" valign="top" align="left"><a href="http://www.diveintopython.net/installing_python/redhat.html#install.unix.1.3"><img src="http://www.diveintopython.net/images/callouts/3.png" alt="3" border="0" width="12" height="12" /></a>
</td>
<td valign="top" align="left">This is the complete path of the newer version of <span class="application">Python</span> that you just installed. Use this on the <tt class="literal">#!</tt> line (the first line of each script) to ensure that scripts are running under the latest version of <span class="application">Python</span>, and be sure to type <b class="userinput"><tt>python2.3</tt></b> to get into the interactive shell.
</td>
</tr>
</table>
</div>
</div>
</div>
<table class="Footer" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
<tr>
<td width="35%" align="left"><br /><a class="NavigationArrow" href="http://www.diveintopython.net/installing_python/macos9.html"><< Python on Mac OS 9</a></td>
<td width="30%" align="center"><br /> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/index.html#install.choosing" title="1.1. Which Python is right for you?">1</a> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/windows.html" title="1.2. Python on Windows">2</a> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/macosx.html" title="1.3. Python on Mac OS X">3</a> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/macos9.html" title="1.4. Python on Mac OS 9">4</a> <span class="divider">|</span> <span class="thispage">5</span> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/debian.html" title="1.6. Python on Debian GNU/Linux">6</a> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/source.html" title="1.7. Python Installation from Source">7</a> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/shell.html" title="1.8. The Interactive Shell">8</a> <span class="divider">|</span> <a href="http://www.diveintopython.net/installing_python/summary.html" title="1.9. Summary">9</a> <span class="divider">|</span>
</td>
<td width="35%" align="right"><br /><a class="NavigationArrow" href="http://www.diveintopython.net/installing_python/debian.html">Python on Debian GNU/Linux >></a></td>
</tr>
<tr>
<td colspan="3"><br /></td>
</tr>
</table>
<div class="Footer">
<p class="copyright">Copyright © 2000, 2001, 2002, 2003, 2004 <a href="mailto:josh@servercobra.com">Mark Pilgrim</a></p>
</div>
</body>
</html>