You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: installing-python-linux.md
+7-21Lines changed: 7 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,25 +10,17 @@ In this course, you'll be writing lots of Python code, so it's important to get
10
10
11
11
Throughout this document, we will:
12
12
13
-
1. Install Python 3.8.0
13
+
1. Install Python 3.9.2
14
14
2. Create a virtual environment using this version of Python.
15
15
3. Inside this environment, install useful packages.
16
16
17
-
This approach works well and is straightforward to set up, but has its drawbacks. For those who feel more comfortable with the command line, we also provide instructions for a better solution involving a tool named `virtualenvwrapper`. In this portion, we will
18
-
19
-
1. Reset our environment to the default state.
20
-
2. Use Python 3.8.0's `pip` to install `virtualenvwrapper`
21
-
3. Use `virtualenvwrapper` to create a managed virtual environment.
22
-
4. Inside this environment, install useful packages.
23
-
5. Modify the shell startup script to activate this virtual environment.
24
-
25
17
Let's get started!
26
18
27
19
## Prerequisite
28
20
29
21
We assume that you have a basic familiarity with the command line. We understand that not everyone will feel comfortable with the command line, because it is covered starting in CS107. However, I highly recommend using Nick Troccoli's amazing [CS107 resources](https://web.stanford.edu/class/archive/cs/cs107/cs107.1194/resources/) for this quarter if you feel less experienced, particular the section titled "Common Unix Commands."
30
22
31
-
## Install Python 3.8.0
23
+
## Install Python 3.9.2
32
24
33
25
On different Linux systems, there are a couple of different ways to install and manage packages. We'll cover `apt-get` here, as well as how you can install from source.
34
26
@@ -39,25 +31,25 @@ On different Linux systems, there are a couple of different ways to install and
39
31
```
40
32
$ sudo add-apt-repository ppa:deadsnakes/ppa
41
33
$ sudo apt-get update
42
-
$ sudo apt-get install python3.8
43
-
$ sudo apt-get install python3.8-venv
34
+
$ sudo apt-get install python3.9
35
+
$ sudo apt-get install python3.9-venv
44
36
```
45
37
46
-
On Debian, we'll just have to `sudo apt-get install python3` and hope for the best. Also note that this might install a different version of Python 3.8, but we won't worry about that here.
38
+
On Debian, we'll just have to `sudo apt-get install python3` and hope for the best. Also note that this might install a different version of Python 3.9, but we won't worry about that here.
47
39
48
40
### Installing with `yum` (RedHat, CentOS)
49
41
50
42
Other Linux distributions use a different package manager, `yum`. We don't have any test devices with these Linux distributions, so you're on your own here. There is a reasonably good tutorial for CentOS [here](https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-centos-7).
51
43
52
44
### Other Linux package managers
53
45
54
-
The world of Linux distributions is unfathomably large. If you can pull off a Python 3.8 install on your distribution of choice, more power to you. However, we recommend building from source.
46
+
The world of Linux distributions is unfathomably large. If you can pull off a Python 3.9 install on your distribution of choice, more power to you. However, we recommend building from source.
55
47
56
48
### Installing from source
57
49
58
50
Installing Python from source follows the same pattern as most other source installations.
59
51
60
-
First, download the source tarball (either [gzipped](https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz) or [XZ compressed](https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz)). Unzip the files and `cd` into the unzipped directory.
52
+
First, download the source tarball (either [gzipped](https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz) or [XZ compressed](https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tar.xz)). Unzip the files and `cd` into the unzipped directory.
61
53
62
54
To build Python, just execute the usual commands:
63
55
@@ -76,11 +68,5 @@ More information on the actual installation process can be found in the tarball'
76
68
77
69
From here, the instructions are almost exactly the same as the [macOS](https://github.com/stanfordpython/python-handouts/blob/master/installing-python-macos.md) instructions. Follow those instructions, with the following differences.
78
70
79
-
### Finding `virtualenvwrapper.sh`
80
-
81
-
If you choose to use `virtualenvwrapper`, it will be installed in a platform-specific location. You will need to find this file. You can use the `find` command described in the linked document to search your computer for the downloaded file.
82
-
83
-
If other unexpected differences come up between those instructions and your operating system, please let us know on Piazza so that we can update these instructions with distribution-specific dependencies.
84
-
85
71
## Credit
86
72
Much of this handout was based on a similar handout written by Sam Redmond (@samredmond)
0 commit comments