Skip to content

A simple shell script to simplify venv operation for python virtual environments

License

Notifications You must be signed in to change notification settings

namastex888/venv.sh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

venv.sh: Simplify Python Virtual Environment Creation and Activation

This repository contains a bash script (venv.sh) that streamlines the process of setting up and managing Python virtual environments. With venv.sh, you can create a new Python virtual environment or activate an existing one using a single venv command.

Prerequisites

  • Python 3.4 or later
  • Bash shell

Installation

  1. Clone this repository to your local machine:

    git clone https://github.com/namastex888/venv.sh.git
    
  2. Navigate to the directory containing the script and make it executable:

    cd venv.sh
    chmod +x venv.sh
  3. Create a bin directory in your home directory if it doesn't exist:

    mkdir -p ~/bin
  4. Move the script to the ~/bin directory in your home directory and rename it to venv:

    mv venv.sh ~/bin/venv
  5. Ensure that the ~/bin directory is in your PATH. You can do this by adding the following line to your ~/.bashrc or ~/.bash_profile file:

    echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc

    Then, run the following command to reload your ~/.bashrc or file:

    source ~/.bashrc

    Now, you should be able to use venv as a command from anywhere in your terminal.

Usage

To create a new Python virtual environment or activate an existing one, use the venv command:

venv

When prompted, enter the name of the virtual environment. If you just press enter without typing a name, the script will use the default name my_venv.

If the virtual environment already exists, the script will activate it. If it does not exist, the script will create it and then activate it.

About

A simple shell script to simplify venv operation for python virtual environments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages