From b9982c5896530515a4dda7e961062d14f18fbde6 Mon Sep 17 00:00:00 2001 From: medusa Date: Sat, 13 Jan 2024 17:04:06 +0000 Subject: [PATCH] Update docs/tech_docs/Python-Virtual-Environments.md --- docs/tech_docs/Python-Virtual-Environments.md | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/docs/tech_docs/Python-Virtual-Environments.md b/docs/tech_docs/Python-Virtual-Environments.md index e8b8d24..d7d07ff 100644 --- a/docs/tech_docs/Python-Virtual-Environments.md +++ b/docs/tech_docs/Python-Virtual-Environments.md @@ -1,5 +1,86 @@ # Setting Up a Virtual Environment for KnowledgeBase-Tech Hugo Site +## Update PATH Environment Variable + +Before installing `virtualenv`, ensure your PATH includes the directory where Python packages are installed. If you see a message like "The script virtualenv is installed in '/home/medusa/.local/bin' which is not on PATH," you'll need to update your PATH. Add the following line to your `.bashrc` or `.profile` file: + +```bash +export PATH="$HOME/.local/bin:$PATH" +``` + +Then, reload your profile: + +```bash +source ~/.bashrc +``` + +or for a login shell: + +```bash +source ~/.profile +``` + +## Install Virtual Environment + +Ensure Python and pip are installed, then install `virtualenv`: + +```bash +pip3 install virtualenv +``` + +## Create the Virtual Environment + +Create a virtual environment named `KnowledgeBase-Tech_env`: + +```bash +virtualenv KnowledgeBase-Tech_env +``` + +## Activate the Virtual Environment + +To start using the virtual environment: + +```bash +source KnowledgeBase-Tech_env/bin/activate +``` + +## Install Dependencies + +While the environment is active, install any required packages: + +```bash +pip install +``` + +## Freeze Requirements + +To keep track of your project's dependencies, you can freeze the installed packages into a `requirements.txt` file: + +```bash +pip freeze > requirements.txt +``` + +This file can be used to install the exact versions of the required packages on other setups or by other developers working on the project. + +## Deactivate the Virtual Environment + +When you're done working, deactivate the environment: + +```bash +deactivate +``` + +## Working with the Environment + +Remember to activate the `KnowledgeBase-Tech_env` environment every time you work on the KnowledgeBase-Tech Hugo site. This ensures all dependencies are isolated to this specific project. +```` + +Replace `` with the specific packages you need for your Hugo site. The addition of the freeze requirements section will help maintain a consistent set of dependencies across different development environments. + +--- + +# Setting Up a Virtual Environment for KnowledgeBase-Tech Hugo Site + ## Install Virtual Environment First, ensure Python and pip are installed, then install `virtualenv`: