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.sh
If 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 --help
or
./pvenv.sh -h
To craft a new virtual environment (default name: .venv), execute:
source ./pvenv.sh create
You can also assign a distinct name to your environment:
source ./pvenv.sh create myenv
For activating an existing virtual environment (default name: .venv), use:
source ./pvenv.sh activate
If your environment boasts a unique name:
source ./pvenv.sh activate myenv
In an existing virtual environment (default name: .venv), installing dependencies is a breeze:
source ./pvenv.sh install
For environments with custom names:
source ./pvenv.sh install myenv
For exporting installed libraries to requirements.txt file, use:
source ./pvenv.sh export
For environments with custom names:
source ./pvenv.sh export myenv
When you're ready to remove an environment (default name: .venv), use:
source ./pvenv.sh remove
If the environment has a specific name:
source ./pvenv.sh remove myenv
Just 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.