-
Notifications
You must be signed in to change notification settings - Fork 2
/
python_venv.txt
30 lines (21 loc) · 1.03 KB
/
python_venv.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
For more info, see: https://stackoverflow.com/questions/41573587/what-is-the-difference-between-venv-pyvenv-pyenv-virtualenv-virtualenvwrappe
Method 1 (recommended): virtualenv + pip + pipx -> distributed management
----------------------------------------------------
Step 1: Install pipx
python3 -m pip install pipx
Step 2: Install Virtual environment
pipx install virtualenv
Step 3: Create dir to store venv
virtualenv <venv dir name> -> default python interpreter
or
virtualenv -p <target python interpreter> <venv dir name> -> specify which python interpreter
Step 4: Activate venv
source <venv dir>/bin/activate
Step 5: Exist venv
deactivate
NOTE: When moving venv dir to other location, remember to update path in all files within venv dir
-> Tips: Open venv dir using vscode; use search & replace to replace /home/<user>/<old path> with /home/<user>/<new path>
----------------------------------------------------
Method 2: pivenv
----------------------------------------------------
----------------------------------------------------