forked from UWPCE-PythonCert/IntroToPython-2014
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_for_linux.html
More file actions
331 lines (257 loc) · 18.1 KB
/
python_for_linux.html
File metadata and controls
331 lines (257 loc) · 18.1 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Setting up Linux for Python and this class — Introduction To Python 1.3 documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="top" title="Introduction To Python 1.3 documentation" href="../index.html"/>
<link rel="up" title="Supplemental Materials" href="index.html"/>
<link rel="next" title="Working with Virtualenv" href="virtualenv.html"/>
<link rel="prev" title="Setting up Windows for Python and this class" href="python_for_windows.html"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-nav-search">
<a href="../index.html" class="fa fa-home"> Introduction To Python</a>
<div role="search">
<form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../session01.html">Session One: Introductions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../session01.html#introductions">Introductions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session01.html#introduction-to-this-class">Introduction to This Class</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session01.html#introduction-to-your-environment">Introduction to Your Environment</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session01.html#setting-up-your-environment">Setting Up Your Environment</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session01.html#introduction-to-ipython">Introduction to iPython</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session01.html#basic-python-syntax">Basic Python Syntax</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session01.html#id2">Homework</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../session02.html">Session Two: Functions, Booleans and Modules</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../session02.html#review-questions">Review/Questions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session02.html#git-work">Git Work</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session02.html#quick-intro-to-basics">Quick Intro to Basics</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session02.html#functions">Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session02.html#in-class-lab">In-Class Lab:</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session02.html#boolean-expressions">Boolean Expressions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session02.html#id1">In-Class Lab:</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session02.html#code-structure-modules-and-namespaces">Code Structure, Modules, and Namespaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session02.html#id4">In-Class Lab</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session02.html#homework">Homework</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../session03.html">Session Three: Sequences, Iteration and String Formatting</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../session03.html#review-questions">Review/Questions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session03.html#sequences">Sequences</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session03.html#lists-tuples">Lists, Tuples...</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session03.html#mutability">Mutability</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session03.html#mutable-sequence-methods">Mutable Sequence Methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session03.html#id1">Iteration</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session03.html#string-features">String Features</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session03.html#one-last-trick">One Last Trick</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session03.html#homework">Homework</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../session04.html">Session Four: Dictionaries, Sets, Exceptions, and Files</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../session04.html#review-questions">Review/Questions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session04.html#a-little-warm-up">A little warm up</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session04.html#dictionaries-and-sets">Dictionaries and Sets</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session04.html#exceptions">Exceptions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session04.html#file-reading-and-writing">File Reading and Writing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session04.html#paths-and-directories">Paths and Directories</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session04.html#homework">Homework</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../session05.html">Session Five: Advanced Argument passing, List and Dict Comprehensions, Lambda and Functional programming</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../session05.html#review-questions">Review/Questions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session05.html#advanced-argument-passing">Advanced Argument Passing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session05.html#a-bit-more-on-mutability-and-copies">A bit more on mutability (and copies)</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session05.html#list-and-dict-comprehensions">List and Dict Comprehensions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session05.html#anonymous-functions">Anonymous functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session05.html#functional-programming">Functional Programming</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session05.html#homework">Homework</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../session06.html">Session Six: Object oriented programming: Classes, instances, attributes, and subclassing</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../session06.html#review-questions">Review/Questions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session06.html#object-oriented-programming">Object Oriented Programming</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session06.html#python-classes">Python Classes</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session06.html#subclassing-inheritance">Subclassing/Inheritance</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session06.html#more-on-subclassing">More on Subclassing</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../session07.html">Session Seven: Testing, More OO</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../session07.html#review-questions">Review/Questions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session07.html#testing">Testing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session07.html#more-on-subclassing">More on Subclassing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session07.html#properties">Properties</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session07.html#static-and-class-methods">Static and Class Methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session07.html#special-methods">Special Methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session07.html#homework">Homework</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../session08.html">Session Eight: Generators, Iterators, Decorators, and Context Managers</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../session08.html#review-questions">Review/Questions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session08.html#decorators">Decorators</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session08.html#iterators-and-generators">Iterators and Generators</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session08.html#context-managers">Context Managers</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session08.html#homework">Homework</a></li>
</ul>
</li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../homework/index.html">Homework Materials</a><ul>
<li class="toctree-l2"><a class="reference internal" href="../homework/kata_fourteen.html">Kata Fourteen: Tom Swift Under Milk Wood</a></li>
<li class="toctree-l2"><a class="reference internal" href="../homework/html_builder.html">HTML Renderer Homework Assignment</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Supplemental Materials</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="python_learning_resources.html">Useful Python Learning Resources</a></li>
<li class="toctree-l2"><a class="reference internal" href="python_for_mac.html">Setting up your Mac for Python and this class</a></li>
<li class="toctree-l2"><a class="reference internal" href="python_for_windows.html">Setting up Windows for Python and this class</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="">Setting up Linux for Python and this class</a></li>
<li class="toctree-l2"><a class="reference internal" href="virtualenv.html">Working with Virtualenv</a></li>
<li class="toctree-l2"><a class="reference internal" href="sublime_as_ide.html">Turning Sublime Text Into a Lightweight Python IDE</a></li>
<li class="toctree-l2"><a class="reference internal" href="shell.html">Shell Customizations for Python Development</a></li>
<li class="toctree-l2"><a class="reference internal" href="unicode.html">Unicode in Python 2</a></li>
</ul>
</li>
</ul>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">Introduction To Python</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html">Docs</a> »</li>
<li><a href="index.html">Supplemental Materials</a> »</li>
<li>Setting up Linux for Python and this class</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/supplements/python_for_linux.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main">
<div class="section" id="setting-up-linux-for-python-and-this-class">
<h1>Setting up Linux for Python and this class<a class="headerlink" href="#setting-up-linux-for-python-and-this-class" title="Permalink to this headline">¶</a></h1>
<p>NOTE: this is from memory: no system to test on right now.</p>
<div class="section" id="getting-the-tools">
<h2>Getting The Tools<a class="headerlink" href="#getting-the-tools" title="Permalink to this headline">¶</a></h2>
<div class="section" id="python">
<h3>Python<a class="headerlink" href="#python" title="Permalink to this headline">¶</a></h3>
<p>You probably already have python. Try:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>python
Python 2.7.8 <span class="o">(</span>v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35<span class="o">)</span>
<span class="o">[</span>GCC 4.2.1 <span class="o">(</span>Apple Inc. build 5666<span class="o">)</span> <span class="o">(</span>dot 3<span class="o">)]</span> on linux
</pre></div>
</div>
<p>You can see what version you’ve got. If you don’t have 2.7.*, then you’ll need to go try to find a newer version – your distribution may have a package named something like:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>apt-get install python2.7
</pre></div>
</div>
<p>Or <tt class="docutils literal"><span class="pre">yum</span> <span class="pre">install</span></tt> or ???</p>
</div>
<div class="section" id="terminal">
<h3>Terminal<a class="headerlink" href="#terminal" title="Permalink to this headline">¶</a></h3>
<p>Every Linux box has a terminal emulator – find and use it.</p>
</div>
<div class="section" id="git">
<h3>git<a class="headerlink" href="#git" title="Permalink to this headline">¶</a></h3>
<p>git is likely to be there on your system already, but if not:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$apt</span>-get install git
</pre></div>
</div>
</div>
<div class="section" id="pip">
<h3>pip<a class="headerlink" href="#pip" title="Permalink to this headline">¶</a></h3>
<p><tt class="docutils literal"><span class="pre">pip</span></tt> is the Python package installer.</p>
<p>Many python packages are also available directly from your distro – but you’ll get the latest and greatest if you use <tt class="docutils literal"><span class="pre">pip</span></tt> to install it instead.</p>
<p>To get pip, the first option is to use your system package manager, something like:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$apt</span>-get install python-pip
</pre></div>
</div>
<p>If that doesn’t work, you can get it from:</p>
<p><a class="reference external" href="https://pip.pypa.io/en/latest/installing.html">https://pip.pypa.io/en/latest/installing.html</a></p>
<p>download <tt class="docutils literal"><span class="pre">get-pip.py</span></tt> from that site, and run it with python:</p>
<div class="highlight-python"><div class="highlight"><pre>$ python get-pip.py
</pre></div>
</div>
<p>It should download and install <tt class="docutils literal"><span class="pre">pip</span></tt> (and <tt class="docutils literal"><span class="pre">setuptools</span></tt>)</p>
<p>You can now use pip to install other packages.</p>
</div>
<div class="section" id="ipython">
<h3>iPython<a class="headerlink" href="#ipython" title="Permalink to this headline">¶</a></h3>
<p>One we are going to use in class is <tt class="docutils literal"><span class="pre">iPython</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre>$ pip install ipython
</pre></div>
</div>
<p>You should now be able to run <tt class="docutils literal"><span class="pre">iPython</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre>$ ipython
Python 2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35)
Type "copyright", "credits" or "license" for more information.
IPython 2.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
</pre></div>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="virtualenv.html" class="btn btn-neutral float-right" title="Working with Virtualenv"/>Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="python_for_windows.html" class="btn btn-neutral" title="Setting up Windows for Python and this class"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
© Copyright 2014, Christopher Barker, Cris Ewing, .
</p>
</div>
<a href="https://github.com/snide/sphinx_rtd_theme">Sphinx theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
VERSION:'1.3',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
</body>
</html>