Skip to content
Browse files

more troubleshooting

  • Loading branch information...
1 parent 241b66f commit d8b2e4a67f804e7e3796fc1c8b5c8996b61a9466 Mark Pilgrim committed
Showing with 53 additions and 12 deletions.
  1. +5 −7 installing-python.html
  2. +1 −1 j/dip3.js
  3. +2 −1 table-of-contents.html
  4. +45 −3 troubleshooting.html
View
12 installing-python.html
@@ -28,14 +28,12 @@ <h2 id=which>Which Python Is Right For You?</h2>
<p>If you're using an account on a hosted server, your <abbr>ISP</abbr> may have already installed Python 3. If you&#8217;re running Linux at home, you may already have Python 3, too. Most popular GNU/Linux distributions come with Python 2 in the default installation; a small but growing number of distributions also include Python 3. Mac OS X includes a command-line version of Python 2, but as of this writing it does not include Python 3. Microsoft Windows does not come with any version of Python. But don&#8217;t despair! You can point-and-click your way through installing Python, regardless of what operating system you have.
-<p>The easiest way to check for Python 3 on your Linux or Mac OS X system is to get to a command line. On Linux, look in your <b><code>Applications</code></b> menu for a program called <b><code>Terminal</code></b>. (It may be in a submenu like <b><code>Accessories</code></b> or <b><code>System</code></b>.) On Mac OS X, there is an application called <b><code>Terminal.app</code></b> in your <code>/Applications/Utilities/</code> folder. (<a href=troubleshooting.html#running-python-on-the-command-line>More command line help</a> is available in the appendix.)
+<p>The easiest way to check for Python 3 on your Linux or Mac OS X system is <a href=troubleshooting.html#getting-to-the-command-line>from the command line</a>. Once you&#8217;re at a command line prompt, just type <kbd>python3</kbd> (all lowercase, no spaces), press <kbd>ENTER</kbd>, and see what happens. On my home Linux system, Python 3.1 is already installed, and this command gets me into the <i>Python <dfn>interactive shell</dfn></i>.
-<p>Once you&#8217;re at a command line prompt, just type <kbd>python3</kbd> (all lowercase, no spaces) and see what happens. On my home Linux system, Python 3 is already installed, and this command gets me into the <i>Python <dfn>interactive shell</dfn></i>.
-
-<pre class='nd screen'>
+<pre class='nd screen cmdline'>
<samp class=p>mark@atlantis:~$ </samp><kbd>python3</kbd>
-<samp>Python 3.0.1+ (r301:69556, Apr 15 2009, 17:25:52)
-[GCC 4.3.3] on linux2
+<samp>Python 3.1 (r31:73572, Jul 28 2009, 06:52:23)
+[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>></samp></pre>
@@ -43,7 +41,7 @@ <h2 id=which>Which Python Is Right For You?</h2>
<p>My <a href=http://cornerhost.com/>web hosting provider</a> also runs Linux and provides command-line access, but my server does not have Python 3 installed. (Boo!)
-<pre class='nd screen'>
+<pre class='nd screen cmdline'>
<samp class=p>mark@manganese:~$ </samp><kbd>python3</kbd>
<samp>bash: python3: command not found</samp></pre>
View
2 j/dip3.js
@@ -143,7 +143,7 @@ $(document).ready(function() {
$(this).wrapInner('<div class=b></div>');
var widgetHTML = '<div class=w>[<a class=toggle href="javascript:toggleCodeBlock(\'' + this.id + '\')">' + HS.visible + '</a>] [<a href="javascript:plainTextOnClick(\'' + this.id + '\')">open in new window</a>]';
if ($(this).hasClass('cmdline')) {
- widgetHTML += ' [<a href="troubleshooting.html#running-python-on-the-command-line">command line help</a>]';
+ widgetHTML += ' [<a href="troubleshooting.html#getting-to-the-command-line">command line help</a>]';
}
widgetHTML += '</div>';
$(this).prepend(widgetHTML);
View
3 table-of-contents.html
@@ -443,7 +443,8 @@
<li id=troubleshooting><a href=troubleshooting.html>Troubleshooting</a>
<ol>
<li><a href=troubleshooting.html#divingin>Diving In</a>
-<li><a href=troubleshooting.html#running-python-on-the-command-line>Running Python on the Command Line</a>
+<li><a href=troubleshooting.html#getting-to-the-command-line>Getting to the Command Line</a>
+<li><a href=troubleshooting.html#running-python-on-the-command-line>Running Python on the command line</a>
</ol>
</ol>
<!-- /toc -->
View
48 troubleshooting.html
@@ -20,12 +20,54 @@
<h2 id=divingin>Diving In</h2>
<p class=f>FIXME
-<h2 id=running-python-on-the-command-line>Running Python on the Command Line</h2>
-<p>Throughout this book, there are examples of executing Python programs from the command line.
+<h2 id=getting-to-the-command-line>Getting to the Command Line</h2>
+<p>Throughout this book, there are examples of executing Python programs from the command line. Where is the command line?
<p>On Linux, look in your <b><code>Applications</code></b> menu for a program called <b><code>Terminal</code></b>. (It may be in a submenu like <b><code>Accessories</code></b> or <b><code>System</code></b>.)
-On Mac OS X, there is an application called <b><code>Terminal</code></b> in your <code>/Applications/Utilities/</code> folder. To get there, click on your desktop, open the <b><code>Go</code></b> menu, select <b><code>Go to folder...</code></b>, and type <kbd>/Applications/Utilities/</kbd>. Then run the <b><code>Terminal</code></b> program.
+<p>On Mac OS X, there is an application called <b><code>Terminal</code></b> in your <code>/Applications/Utilities/</code> folder. To get there, click on your desktop, open the <b><code>Go</code></b> menu, select <b><code>Go to folder...</code></b>, and type <kbd>/Applications/Utilities/</kbd>. Then double-click the <b><code>Terminal</code></b> program.
+
+<p>On Windows, click <b><code>Start</code></b>, select <b><code>Run...</code></b>, type <kbd>cmd</kbd>, and press <kbd>ENTER</kbd>.
+
+<h2 id=running-python-on-the-command-line>Running Python on the command line</h2>
+
+<p>Once you <a href=#getting-to-the-command-line>get to the command line</a>, you should be able to run the Python interactive shell. On the Linux or Mac OS X command line, type <kbd>python3</kbd> and press <kbd>ENTER</kbd>. On the Windows command line, type <kbd>c:\python31\python</kbd> and press <kbd>ENTER</kbd>. If all goes well, you should see something like this:
+
+<pre class='nd screen'>
+<samp class=p>you@localhost:~$ </samp><kbd>python3</kbd>
+<samp>Python 3.1 (r31:73572, Jul 28 2009, 06:52:23)
+[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
+Type "help", "copyright", "credits" or "license" for more information.
+>>></samp></pre>
+
+<p>(Type <kbd>exit()</kbd> and press <kbd>ENTER</kbd> to exit the Python interactive shell and go back to the command line. This works on all platforms.)
+
+<p>If you get a &#8220;command not found&#8221; error, it probably means you <a href=installing-python.html>don&#8217;t have Python 3 installed</a>.
+
+<pre class='nd screen'>
+<samp class=p>you@localhost:~$ </samp><kbd>python3</kbd>
+<samp>bash: python3: command not found</samp></pre>
+
+<p>On the other hand, if you get into a Python interactive shell but the version number is not what you expected, you may have more than one version of Python installed. This happens most often on Linux and Mac OS X systems, where an older version of Python is pre-installed. You can install the latest version without deleting the older version (they will live side-by-side in peace), but you will need to be more specific when you run Python from the command line.
+
+<p>For example, on my home Linux box, I have several versions of Python installed so I can test the Python software that I write. To run a specific version, I can type <code>python3.0</code>, <code>python3.1</code>, or <code>python2.6</code>.
+
+<pre class='nd screen'>
+<samp class=p>mark@atlantis:~$ </samp><kbd>python3.0</kbd>
+<samp>Python 3.0.1+ (r301:69556, Apr 15 2009, 17:25:52)
+[GCC 4.3.3] on linux2
+Type "help", "copyright", "credits" or "license" for more information.
+>>> </samp><kbd class=pp>exit()</kbd>
+<samp class=p>mark@atlantis:~$ </samp><kbd>python3.1</kbd>
+<samp>Python 3.1 (r31:73572, Jul 28 2009, 06:52:23)
+[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
+Type "help", "copyright", "credits" or "license" for more information.
+>>> </samp><kbd class=pp>exit()</kbd>
+<samp class=p>mark@atlantis:~$ </samp><kbd>python2.6</kbd>
+<samp>Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
+[GCC 4.4.3] on linux2
+Type "help", "copyright", "credits" or "license" for more information.
+>>> </samp><kbd class=pp>exit()</kbd></pre>
<p class=v><a rel=prev href=where-to-go-from-here.html title='back to &#8220;Where To Go From Here&#8221;'><span class=u>&#x261C;</span></a> <a href=blank.html rel=next><span class=u>&#x261E;</span></a>

0 comments on commit d8b2e4a

Please sign in to comment.
Something went wrong with that request. Please try again.