@@ -61,28 +61,26 @@ <h2>1. Install the Python development environment on your system</h2>
61
61
Check if your Python environment is already configured:
62
62
</ p >
63
63
64
- < aside class ="note "> Requires Python 3.5–3.8 and pip >= 19.0</ aside >
64
+ < aside class ="note "> Requires Python 3.5–3.8, pip and venv >= 19.0</ aside >
65
65
66
66
< pre class ="prettyprint lang-bsh ">
67
67
< code class ="devsite-terminal "> python3 --version</ code >
68
68
< code class ="devsite-terminal "> pip3 --version</ code >
69
- < code class ="devsite-terminal "> virtualenv --version</ code >
70
69
</ pre >
71
70
72
71
< p >
73
72
If these packages are already installed, skip to the next step.< br />
74
73
Otherwise, install < a href ="https://www.python.org/ " class ="external "> Python</ a > , the
75
74
< a href ="https://pip.pypa.io/en/stable/installing/ " class ="external "> pip package manager</ a > ,
76
- and < a href ="https://virtualenv.pypa.io/en/stable/ " class ="external "> Virtualenv </ a > :
75
+ and < a href ="https://docs.python.org/3/library/venv.html " class ="external "> venv </ a > :
77
76
</ p >
78
77
79
78
< div class ="ds-selector-tabs ">
80
79
< section >
81
80
< h3 > Ubuntu</ h3 >
82
81
< pre class ="prettyprint lang-bsh ">
83
82
< code class ="devsite-terminal "> sudo apt update</ code >
84
- < code class ="devsite-terminal "> sudo apt install python3-dev python3-pip</ code >
85
- < code class ="devsite-terminal "> sudo pip3 install -U virtualenv # system-wide install</ code >
83
+ < code class ="devsite-terminal "> sudo apt install python3-dev python3-pip python3-venv</ code >
86
84
</ pre >
87
85
</ section >
88
86
@@ -94,7 +92,6 @@ <h3>mac OS</h3>
94
92
< code class ="devsite-terminal "> export PATH="/usr/local/bin:/usr/local/sbin:$PATH"</ code >
95
93
< code class ="devsite-terminal "> brew update</ code >
96
94
< code class ="devsite-terminal "> brew install python # Python 3</ code >
97
- < code class ="devsite-terminal "> sudo pip3 install -U virtualenv # system-wide install</ code >
98
95
</ pre >
99
96
</ section >
100
97
@@ -113,17 +110,15 @@ <h3>Windows</h3>
113
110
</ ol >
114
111
< p > Make sure < a href ="https://superuser.com/questions/1119883/windows-10-enable-ntfs-long-paths-policy-option-missing " class ="external "> long paths are enabled</ a > on Windows.</ p >
115
112
< p > Install the < em > 64-bit</ em > < a href ="https://www.python.org/downloads/windows/ " class ="external "> Python 3 release for Windows</ a > (select < code > pip</ code > as an optional feature).</ p >
116
- < pre class ="devsite-terminal tfo-terminal-windows devsite-click-to-copy "> pip3 install -U pip virtualenv</ pre >
117
113
</ section >
118
114
119
115
< section >
120
116
< h3 > Raspberry Pi</ h3 >
121
117
< p > Requirements for the < a href ="https://www.raspberrypi.org/downloads/raspbian/ " class ="external "> Raspbian</ a > operating system:</ p >
122
118
< pre class ="prettyprint lang-bsh ">
123
119
< code class ="devsite-terminal "> sudo apt update</ code >
124
- < code class ="devsite-terminal "> sudo apt install python3-dev python3-pip</ code >
120
+ < code class ="devsite-terminal "> sudo apt install python3-dev python3-pip python3-venv </ code >
125
121
< code class ="devsite-terminal "> sudo apt install libatlas-base-dev # required for numpy</ code >
126
- < code class ="devsite-terminal "> sudo pip3 install -U virtualenv # system-wide install</ code >
127
122
</ pre >
128
123
</ section >
129
124
@@ -132,7 +127,6 @@ <h3>Other</h3>
132
127
< pre class ="prettyprint lang-bsh ">
133
128
< code class ="devsite-terminal "> curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py</ code >
134
129
< code class ="devsite-terminal "> python get-pip.py</ code >
135
- < code class ="devsite-terminal "> sudo pip3 install -U virtualenv # system-wide install</ code >
136
130
</ pre >
137
131
</ section >
138
132
</ div > <!--/ds-selector-tabs-->
@@ -158,13 +152,16 @@ <h3>Ubuntu / mac OS</h3>
158
152
Create a new virtual environment by choosing a Python interpreter and making a
159
153
< code > ./venv</ code > directory to hold it:
160
154
</ p >
161
- < pre class ="devsite-terminal devsite-click-to-copy "> virtualenv -- system-site-packages -p python3 < var > ./venv</ var > </ pre >
155
+ < pre class ="devsite-terminal devsite-click-to-copy "> python3 -m venv -- system-site-packages < var > ./venv</ var > </ pre >
162
156
< p >
163
157
Activate the virtual environment using a shell-specific command:
164
158
</ p >
165
- < pre class ="devsite-terminal prettyprint lang-bsh "> source < var > ./venv</ var > /bin/activate # sh, bash, ksh, or zsh</ pre >
159
+ < pre class ="devsite-terminal prettyprint lang-bsh "> source < var > ./venv</ var > /bin/activate # sh, bash, or zsh</ pre >
160
+ < pre class ="devsite-terminal prettyprint lang-bsh "> . < var > ./venv</ var > /bin/activate.fish # fish</ pre >
161
+ < pre class ="devsite-terminal prettyprint lang-bsh "> source < var > ./venv</ var > /bin/activate.csh # csh or tcsh</ pre >
162
+
166
163
< p >
167
- When virtualenv is active, your shell prompt is prefixed with < code > (venv)</ code > .
164
+ When the virtual environment is active, your shell prompt is prefixed with < code > (venv)</ code > .
168
165
</ p >
169
166
< p >
170
167
Install packages within a virtual environment without affecting the host system
@@ -176,7 +173,7 @@ <h3>Ubuntu / mac OS</h3>
176
173
< code class ="devsite-terminal tfo-terminal-venv "> pip list # show packages installed within the virtual environment</ code >
177
174
</ pre >
178
175
< p >
179
- And to exit virtualenv later:
176
+ And to exit the virtual environment later:
180
177
</ p >
181
178
< pre class ="devsite-terminal tfo-terminal-venv prettyprint lang-bsh "> deactivate # don't exit until you're done using TensorFlow</ pre >
182
179
</ section >
@@ -188,7 +185,7 @@ <h3>Windows</h3>
188
185
Create a new virtual environment by choosing a Python interpreter and making a
189
186
< code > .\venv</ code > directory to hold it:
190
187
</ p >
191
- < pre class ="devsite-terminal tfo-terminal-windows devsite-click-to-copy "> virtualenv -- system-site-packages -p python3 < var > ./ venv</ var > </ pre >
188
+ < pre class ="devsite-terminal tfo-terminal-windows devsite-click-to-copy "> python -m venv -- system-site-packages < var > .\ venv</ var > </ pre >
192
189
< p >
193
190
Activate the virtual environment:
194
191
</ p >
@@ -203,7 +200,7 @@ <h3>Windows</h3>
203
200
< code class ="devsite-terminal tfo-terminal-windows-venv "> pip list # show packages installed within the virtual environment</ code >
204
201
</ pre >
205
202
< p >
206
- And to exit virtualenv later:
203
+ And to exit the virtual environment later:
207
204
</ p >
208
205
< pre class ="devsite-terminal tfo-terminal-windows-venv prettyprint lang-bsh "> deactivate # don't exit until you're done using TensorFlow</ pre >
209
206
</ section >
@@ -240,7 +237,7 @@ <h2>3. Install the TensorFlow pip package</h2>
240
237
241
238
< div class ="ds-selector-tabs ">
242
239
< section >
243
- < h3 > Virtualenv install</ h3 >
240
+ < h3 > Virtual environment install</ h3 >
244
241
< pre class ="devsite-terminal tfo-terminal-venv devsite-click-to-copy prettyprint lang-bsh "> pip install --upgrade tensorflow</ pre >
245
242
< p > Verify the install:</ p >
246
243
< pre class ="devsite-terminal tfo-terminal-venv devsite-click-to-copy prettyprint lang-bsh "> python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"</ pre >
0 commit comments