Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d411ec1

Browse files
Update Mac setup guide (GoogleCloudPlatform#2697)
Update Mac setup guide Fixes GoogleCloudPlatform#2693 Add instructions for Catalina Move installation verification after installation of specific versions Update latest python versions and add commands for each Add console label to code blocks Remove username
1 parent 23cf903 commit d411ec1

File tree

1 file changed

+45
-37
lines changed

1 file changed

+45
-37
lines changed

MAC_SETUP.md

Lines changed: 45 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,26 @@ test their code.
1010

1111
## Before you begin
1212

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.
1419

1520
## Installing pyenv and pyenv-virtualenv
1621

1722
1. Install [pyenv](https://github.com/pyenv/pyenv).
1823

19-
I (tswast@) use [homebrew](https://brew.sh/) to install it.
20-
21-
```
24+
```console
2225
brew update
2326
brew install pyenv
2427
```
2528

2629
1. Install the [pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv)
2730
plugin.
2831

29-
```
32+
```console
3033
brew install pyenv-virtualenv
3134
```
3235

@@ -37,80 +40,85 @@ test their code.
3740
eval "$(pyenv virtualenv-init -)"
3841
```
3942

40-
Note that this also works with ZSH.
43+
**Note:** This also works with ZSH.
4144

4245
1. Reload your shell.
4346

44-
```
47+
```console
4548
source ~/.bashrc
4649
```
4750

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-
5651
## Installing multiple Python versions
5752

5853

5954
1. See the available Python versions with
6055

61-
```
56+
```console
6257
pyenv install --list
6358
```
6459

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
6661
version you want isn't listed, you may need to upgrade your pyenv with
6762
homebrew.
6863

69-
```
64+
```console
7065
brew update
7166
brew upgrade pyenv
7267
```
7368
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
7678
```
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
7890
```
79-
80-
8191

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.
8594

86-
As of December 9, 2019 latest Python versions are:
95+
```console
96+
$ which python
97+
~/.pyenv/shims/python
98+
```
8799

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)
92100

93101
## Using pyenv and pyenv-virtualenv to manage your Python versions
94102

95103
1. Change to the desired source directory.
96104

97-
```
105+
```console
98106
cd ~/src/python-docs-samples
99107
```
100108

101109
1. Create a virtualenv using `pyenv virtualenv`.
102110

103-
```
104-
pyenv virtualenv 3.6.4 python-docs-samples
111+
```console
112+
pyenv virtualenv 3.7.6 python-docs-samples
105113
```
106114

107115
This creates a virtualenv folder within `~/.pyenv/versions/`.
108116

109117
1. Set the local Python version(s) with `pyenv local`
110118

111-
```
119+
```console
112120
# 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
114122
```
115123

116124
1. Now, when you `cd` into the source directory or a subdirectory within it,
@@ -120,4 +128,4 @@ test their code.
120128

121129
1. Add `.python-version` to your [global gitignore
122130
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

Comments
 (0)