Streamlined Bash scripts for managing Python virtual environments, with support for both virtualenv and conda.
In the coding universe, things can sometimes get confusing when dealing with virtual spaces. But don't worry! There's a cool trick that can make your life a whole lot easier: a special bash script that takes care of all the confusing parts for you. Bash scripts provides:
- Checking Virtual Environment Installation
- Creating Virtual Environments
- Activate Virtual Environments
- Streamlined Dependency Installation
- Export dependencies
- Remove Virtual Environments
Using pvenv.sh is straightforward, but let's walk through each action step by step. Here's how you can utilize its features right from your terminal:
Before you dive in, ensure that the script is executable. You can grant the necessary permissions using the command:
chmod +x pvenv.shIf you're ever unsure about what pvenv.sh can do for you, just ask it for help! To display a comprehensive explanation of the script's capabilities and available options, simply run:
./pvenv.sh --helpor
./pvenv.sh -hTo craft a new virtual environment (default name: .venv), execute:
source ./pvenv.sh createYou can also assign a distinct name to your environment:
source ./pvenv.sh create myenvFor activating an existing virtual environment (default name: .venv), use:
source ./pvenv.sh activateIf your environment boasts a unique name:
source ./pvenv.sh activate myenvIn an existing virtual environment (default name: .venv), installing dependencies is a breeze:
source ./pvenv.sh installFor environments with custom names:
source ./pvenv.sh install myenvFor exporting installed libraries to requirements.txt file, use:
source ./pvenv.sh exportFor environments with custom names:
source ./pvenv.sh export myenvWhen you're ready to remove an environment (default name: .venv), use:
source ./pvenv.sh removeIf the environment has a specific name:
source ./pvenv.sh remove myenvJust as pvenv.sh simplifies Python virtual environment management using virtualenv, cvenv.sh streamlines the process using conda. This companion script offers similar functionalities for managing Conda environments.