@@ -10,23 +10,26 @@ test their code.
10
10
11
11
## Before you begin
12
12
13
- 1 . [ Optional] Install [ homebrew] ( https://brew.sh/ ) .
13
+ 1 . Install [ homebrew] ( https://brew.sh/ ) if you do not already have it.
14
+
15
+ ** Note:** If you are running Catalina (MacOS 10.15.x), ensure that you have a
16
+ compatible version of Homebrew (2.1.13 or later). Running ` brew update ` on
17
+ Catalina does not always result in a compatible version, so uninstall and
18
+ reinstall homebrew, if necessary.
14
19
15
20
## Installing pyenv and pyenv-virtualenv
16
21
17
22
1 . Install [ pyenv] ( https://github.com/pyenv/pyenv ) .
18
23
19
- I (tswast@) use [ homebrew] ( https://brew.sh/ ) to install it.
20
-
21
- ```
24
+ ``` console
22
25
brew update
23
26
brew install pyenv
24
27
```
25
28
26
29
1. Install the [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv)
27
30
plugin.
28
31
29
- ```
32
+ ```console
30
33
brew install pyenv-virtualenv
31
34
```
32
35
@@ -37,80 +40,85 @@ test their code.
37
40
eval "$(pyenv virtualenv-init -)"
38
41
```
39
42
40
- Note that this also works with ZSH.
43
+ ** Note:** This also works with ZSH.
41
44
42
45
1. Reload your shell.
43
46
44
- ```
47
+ ```console
45
48
source ~/.bashrc
46
49
```
47
50
48
- 1. After you have installed a python version through pyenv (see below),
49
- verify that you are now using the pyenv Python shim.
50
-
51
- ```
52
- $ which python
53
- /Users/tswast/.pyenv/shims/python
54
- ```
55
-
56
51
## Installing multiple Python versions
57
52
58
53
59
54
1. See the available Python versions with
60
55
61
- ```
56
+ ```console
62
57
pyenv install --list
63
58
```
64
59
65
- The Python versions are at the top of the long list. If the Python
60
+ **Note:** The Python versions are at the top of the long list. If the Python
66
61
version you want isn't listed, you may need to upgrade your pyenv with
67
62
homebrew.
68
63
69
- ```
64
+ ```console
70
65
brew update
71
66
brew upgrade pyenv
72
67
```
73
68
74
- View the options related to a specific release with
75
-
69
+ 1. Install the necessary Python versions with pyenv. Use the latest release
70
+ of the versions you wish to test against. A list of available versions
71
+ is available on [python.org](https://www.python.org/doc/versions/)
72
+
73
+ As of January 8, 2020, the latest Python versions are:
74
+
75
+ * 2.7.17 (latest 2.7.x release)
76
+ ```console
77
+ $ pyenv install 2.7.17
76
78
```
77
- pyenv install 3.x
79
+ * 3.5.9 (latest 3.5.x release)
80
+ ```console
81
+ $ pyenv install 3.5.9
82
+ ```
83
+ * 3.6.10 (latest 3.6.x release)
84
+ ```console
85
+ $ pyenv install 3.6.10
86
+ ```
87
+ * 3.7.6 (latest 3.7.x release)
88
+ ```console
89
+ $ pyenv install 3.7.6
78
90
```
79
-
80
-
81
91
82
- 1. Compile the necessary Python versions with pyenv. Use the latest release
83
- of the versions you wish to test against. A list of available versions
84
- is available on [python.org](https://www.python.org/doc/versions/)
92
+ 1. After you have installed a python version through pyenv,
93
+ verify that you are now using the pyenv Python shim.
85
94
86
- As of December 9, 2019 latest Python versions are:
95
+ ```console
96
+ $ which python
97
+ ~/.pyenv/shims/python
98
+ ```
87
99
88
- * 2.7.17 (latest 2.7.x release)
89
- * 3.5.8 (latest 3.5.x release)
90
- * 3.6.9 (latest 3.6.x release)
91
- * 3.7.5 (latest 3.7.x release)
92
100
93
101
## Using pyenv and pyenv-virtualenv to manage your Python versions
94
102
95
103
1. Change to the desired source directory.
96
104
97
- ```
105
+ ```console
98
106
cd ~/src/python-docs-samples
99
107
```
100
108
101
109
1. Create a virtualenv using `pyenv virtualenv`.
102
110
103
- ```
104
- pyenv virtualenv 3.6.4 python-docs-samples
111
+ ```console
112
+ pyenv virtualenv 3.7.6 python-docs-samples
105
113
```
106
114
107
115
This creates a virtualenv folder within `~/.pyenv/versions/`.
108
116
109
117
1. Set the local Python version(s) with `pyenv local`
110
118
111
- ```
119
+ ```console
112
120
# pyenv local [name of virtualenv] [list of python versions to use]
113
- pyenv local python-docs-samples 3.6.4 3.7.0 3.5.4 2.7.15
121
+ pyenv local python-docs-samples 3.6.10 3.7.6 3.5.9 2.7.17
114
122
```
115
123
116
124
1. Now, when you `cd` into the source directory or a subdirectory within it,
@@ -120,4 +128,4 @@ test their code.
120
128
121
129
1. Add `.python-version` to your [global gitignore
122
130
file](https://help.github.com/articles/ignoring-files/#create-a-global-gitignore),
123
- so it wont be committed into the repository.
131
+ so it won't be committed into the repository.
0 commit comments