@@ -7,7 +7,7 @@ itself installed. There are two, largely equivalent, ways of doing
7
7
that, and we describe both below.
8
8
9
9
If you have a working version of Python on your system already (check
10
- by running ` python3 ` ), you can skip to setting up a virtual environment.
10
+ by running ` python ` at the terminal ), you can skip to "Segment 1: Set up a virtual environment" .
11
11
12
12
## Segment 1: Python.org
13
13
@@ -20,23 +20,16 @@ Download the installer from https://www.python.org/downloads/.
20
20
A virtual environment is a workspace into which you can install Python
21
21
libraries, separate from what is being used by your operating system.
22
22
23
- Create a new virtual environment in a directory called
24
- ` py3 ` :
23
+ Here, we create a new virtual environment in a directory ` science ` (you can use whichever name you prefer!):
25
24
26
25
```
27
- python -m venv py3
26
+ python -m venv science
28
27
```
29
28
30
- Start using it as follows:
29
+ Start using it by activating it as follows:
31
30
32
31
```
33
- source py3/bin/activate
34
- ```
35
-
36
- Also, make sure you have ` pip ` installed---that is Python's default package manager:
37
-
38
- ```
39
- python -m ensurepip
32
+ source science/bin/activate
40
33
```
41
34
42
35
You are now ready to install Scientific Python packages using ` pip ` ! For example:
@@ -56,6 +49,12 @@ In [2]: np.linspace(0, 10, 5)
56
49
Out[2]: array([ 0. , 2.5, 5. , 7.5, 10. ])
57
50
```
58
51
52
+ Remember to re-activate your environment every time you open a new terminal, using:
53
+
54
+ ```
55
+ source science/bin/activate
56
+ ```
57
+
59
58
## Segment 2: Miniforge
60
59
61
60
Miniforge is a small Python distribution based around the conda
@@ -112,3 +111,9 @@ In [1]: import numpy as np
112
111
In [2]: np.linspace(0, 10, 5)
113
112
Out[2]: array([ 0. , 2.5, 5. , 7.5, 10. ])
114
113
```
114
+
115
+ Remember to re-activate your environment every time you open a new terminal:
116
+
117
+ ```
118
+ conda activate science
119
+ ```
0 commit comments