-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvirtual_environments
16 lines (15 loc) · 1002 Bytes
/
virtual_environments
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
1. Create a new project folder
2. From the CLI go into that folder
3a. virtualenv --no-site-packages env # Python2
3b. python3.6 -m venv <folder_name> # Python3
3c. C:\Users\janderson\AppData\Local\Programs\Python\Python36\python.exe -m venv env
4. This creates a new folder in your directory called 'env' that gets python, pip, wheel, etc
5a. To activate your virtual environment you type 'env\Scripts\activate' (windows)
5b. To activate on linux you type 'source env/bin/activate'
6. Your CLI prompt will now be prepended with (env) c:\xxx
7. From this stage you can install whatever you need and it will not overlap with other projects
8. To restore from a requirements.txt file you would type 'pip install -r requirements.txt'
9. To update the requirements file post package change 'pip freeze > requirements.txt'
10. To deactivate the environment type 'deactivate'
# To update all out of date packages in pip
pip list --outdated | cut -d ' ' -f1 | xargs -n1 pip install -U