1.8 KiB
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:
export PATH="$HOME/.local/bin:$PATH"
Then, reload your profile:
source ~/.bashrc
or for a login shell:
source ~/.profile
Install Virtual Environment
Ensure Python and pip are installed, then install virtualenv:
pip3 install virtualenv
Create the Virtual Environment
Create a virtual environment named KnowledgeBase-Tech_env:
virtualenv KnowledgeBase-Tech_env
Activate the Virtual Environment
To start using the virtual environment:
source KnowledgeBase-Tech_env/bin/activate
Install Dependencies
While the environment is active, install any required packages:
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:
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:
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.