Alternative: Use Docker - Container for Python (it sucks)
On CLI:
- Move to the desired location using
cd.
REMEBER: if you want to go to another directory (C:\ ⇒ D:\) usecd \d. python -m venv [VIRUTAL ENVIRONMENT NAME]
NOTE: This will create a new folder.- `cd [VIRUTAL ENVIRONMENT NAME]“
Scripts\activate.bat- To install modules and packages only on the virtual environment use
python -m pip install [PACKAGE NAME] - To exit the virtual environment:
Scripts\deactivate.bat
On CLI - Similar Way:
- Move to the desired location using
cd.
REMEBER: if you want to go to another directory (C:\ ⇒ D:\) usecd \d. python -m venv [VIRUTAL ENVIRONMENT NAME]
NOTE: This will create a new folder.[VIRUTAL ENVIRONMENT NAME]\Scripts\activate.bat- To install modules and packages only on the virtual environment use
python -m pip install [PACKAGE NAME] - To exit the virtual environment: `[VIRUTAL ENVIRONMENT NAME]\Scripts\deactivate.bat
Move/Sync your Virtual Environment (Method I):
(TO BE TESTED, not sure if it will work)
- Create 2 virtual environments (where you want to move/sync)
- After installing the wanted libraries use the command
python -m pip freeze > requirements.txtI - In the other virtual environment use the command:
python -m pip install -r requirements.txt
- Source: StackOverflow
Move/Sync your Virtual Environment (Method II):
- Create 2 virtual environments (where you want to move/sync)
- Copy everything exepts the
Scriptsfolder from venv_1 to venv_2 - (Optional): With Syncthing we can add to the ingore patterns Scripts, this will exclude the
Scriptsfolder to be synced
On Sublime Text:
- Create a new project in the :
[VIRUTAL ENVIRONMENT NAME]directory just created.Hamburger Menu -> Project -> Save Project As - Once it has create a project it will also create a
.sublime-projectfile and a.sublime-workspacefile, in the.sublime-projectfile past this code (changed accordingly){ "folders": [ { "path": ".." } ], "build_systems": [ { "name" : "[BUILD SYSTEM NAME]", "cmd": ["$folder/Scripts/python.exe", "$file"], "selector": "source.python", "file_regex": "^\\s*File \"(...*?)\", line ([0-9]*)" } ]
}
---
# Online Resources
- [Online ‘venv’ explenation](https://www.youtube.com/watch?v=APOPm01BVrk)
- [Python Official Guide](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/)
- [Sublime Text Official Documentation](https://www.sublimetext.com/docs/build_systems.html)