75 lines
1.8 KiB
Markdown
75 lines
1.8 KiB
Markdown
# Setting Up a Virtual Environment for KnowledgeBase-Tech MKDocs 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 <package-name>
|
|
```
|
|
|
|
## 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. |