# Virtualenv

## Install virtualenvwrapper and create your first virtualenv

Install virtualenvwrapper

```bash
sudo pip3 install virtualenvwrapper
```

Edit your `bashrc` file and add te following content.

{% code title="\~/.bashrc" %}

```bash
export WORKON_HOME="$HOME/virtualenvs"
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
source /usr/local/bin/virtualenvwrapper.sh
```

{% endcode %}

Then run.

```
source ~/.bashrc
```

Create a virtualenv.

```bash
mkvirtualenv env1
```

## Setup .bashrc config

Add the following lines in your `~/.bashrc` file.

{% code title="\~/.bashrc" %}

```bash
# Virtualenvs
export WORKON_HOME=~/virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
```

{% endcode %}

## Useful commands

### Change virtualenv

```bash
 workon yourvirtualenvname 
```

### "Logout" from a virtualenv

```bash
deactivate
```

### "cd" to your virtualenv automatically

Run this only one time.

```bash
workon yourvirtualenvname
echo 'cd $VIRTUAL_ENV' >> $WORKON_HOME/postactivate
```

## References

<https://hub.docker.com/r/chenjr0719/ubuntu-unity-novnc/>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.devops.buzz/public/python/virtualenv.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
