Last modified by Leon Poon on 2021/03/23 13:16

Show last authors
1 {{toc/}}
2
3 = Download =
4
5 Go to [[url:https://www.python.org/downloads/release/python-365/]].
6
7 Scroll down to the "Files" section.
8
9 Click on "macOS 64-bit installer". Download will start.
10
11
12 = Install =
13
14 After download is complete, double click the package and complete the install.
15
16 To test that the installation works, open Terminal application and type:
17
18 {{code language="plain"}}
19 which python3
20 {{/code}}
21
22 It should say something like:
23
24 {{code language="plain"}}
25 /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
26 {{/code}}
27
28 Then type this and press enter:
29
30 {{code language="plain"}}
31 python3
32 {{/code}}
33
34 If it shows this then you are OK:
35
36 {{code language="plain"}}
37 Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 05:52:31)
38 [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
39 Type "help", "copyright", "credits" or "license" for more information.
40 >>>
41 {{/code}}
42
43 Press CTRL-D to exit python3.
44
45
46 = Install Pip =
47
48 Open Terminal application.
49
50 type this and press enter:
51
52 {{code language="plain"}}
53 pip3
54 {{/code}}
55
56 If you get the following output you are OK:
57
58 {{code language="plain"}}
59 Usage:
60 pip <command> [options]
61
62 Commands:
63 install Install packages.
64 download Download packages.
65 uninstall Uninstall packages.
66 freeze Output installed packages in requirements format.
67 list List installed packages.
68 show Show information about installed packages.
69 check Verify installed packages have compatible dependencies.
70 search Search PyPI for packages.
71 wheel Build wheels from your requirements.
72 hash Compute hashes of package archives.
73 completion A helper command used for command completion.
74 help Show help for commands.
75
76 General Options:
77 -h, --help Show help.
78 --isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
79 -v, --verbose Give more output. Option is additive, and can be used up to 3 times.
80 -V, --version Show version and exit.
81 -q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to
82 WARNING, ERROR, and CRITICAL logging levels).
83 --log <path> Path to a verbose appending log.
84 --proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
85 --retries <retries> Maximum number of retries each connection should attempt (default 5 times).
86 --timeout <sec> Set the socket timeout (default 15 seconds).
87 --exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup,
88 (a)bort.
89 --trusted-host <hostname> Mark this host as trusted, even though it does not have valid or any HTTPS.
90 --cert <path> Path to alternate CA bundle.
91 --client-cert <path> Path to SSL client certificate, a single file containing the private key and the
92 certificate in PEM format.
93 --cache-dir <dir> Store the cache data in <dir>.
94 --no-cache-dir Disable the cache.
95 --disable-pip-version-check
96 Don't periodically check PyPI to determine whether a new version of pip is available for
97 download. Implied with --no-index.
98 {{/code}}
99
100 = Install Virtual Env =
101
102 Open Terminal application.
103
104 Type and press enter:
105
106 {{code language="plain"}}
107 pip3 install virtualenv
108 {{/code}}
109
110 It should say something like:
111
112 {{code language="plain"}}
113 Collecting virtualenv
114 Downloading https://files.pythonhosted.org/packages/b6/30/96a02b2287098b23b875bc8c2f58071c35d2efe84f747b64d523721dc2b5/virtualenv-16.0.0-py2.py3-none-any.whl (1.9MB)
115 100% |████████████████████████████████| 1.9MB 765kB/s
116 Installing collected packages: virtualenv
117 Successfully installed virtualenv-16.0.0
118
119 {{/code}}
120
121 To check that it works, type in Terminal application and press enter:
122
123 {{code language="plain"}}
124 which virtualenv
125 {{/code}}
126
127 It should say something like:
128
129 {{code language="plain"}}
130 /Library/Frameworks/Python.framework/Versions/3.6/bin/virtualenv
131 {{/code}}
132
133 Then type this and press enter:
134
135 {{code language="plain"}}
136 virtualenv
137 {{/code}}
138
139 If it shows the following, you are OK.
140
141 {{code language="plain"}}
142 You must provide a DEST_DIR
143 Usage: virtualenv [OPTIONS] DEST_DIR
144
145 Options:
146 --version show program's version number and exit
147 -h, --help show this help message and exit
148 -v, --verbose Increase verbosity.
149 -q, --quiet Decrease verbosity.
150 -p PYTHON_EXE, --python=PYTHON_EXE
151 The Python interpreter to use, e.g.,
152 --python=python3.5 will use the python3.5 interpreter
153 to create the new environment. The default is the
154 interpreter that virtualenv was installed with (/Libra
155 ry/Frameworks/Python.framework/Versions/3.6/bin/python
156 3.6)
157 --clear Clear out the non-root install and start from scratch.
158 --no-site-packages DEPRECATED. Retained only for backward compatibility.
159 Not having access to global site-packages is now the
160 default behavior.
161 --system-site-packages
162 Give the virtual environment access to the global
163 site-packages.
164 --always-copy Always copy files rather than symlinking.
165 --relocatable Make an EXISTING virtualenv environment relocatable.
166 This fixes up scripts and makes all .pth files
167 relative.
168 --no-setuptools Do not install setuptools in the new virtualenv.
169 --no-pip Do not install pip in the new virtualenv.
170 --no-wheel Do not install wheel in the new virtualenv.
171 --extra-search-dir=DIR
172 Directory to look for setuptools/pip distributions in.
173 This option can be used multiple times.
174 --download Download preinstalled packages from PyPI.
175 --no-download, --never-download
176 Do not download preinstalled packages from PyPI.
177 --prompt=PROMPT Provides an alternative prompt prefix for this
178 environment.
179 --setuptools DEPRECATED. Retained only for backward compatibility.
180 This option has no effect.
181 --distribute DEPRECATED. Retained only for backward compatibility.
182 This option has no effect.
183 --unzip-setuptools DEPRECATED. Retained only for backward compatibility.
184 This option has no effect.
185 {{/code}}