# Python with Venv

@page [\[ venv \]](https://docs.python.org/3/library/venv.html)

### Go to the directory for your project

create the folder $mkdir my\_project

structure:

my\_project:

&#x20;       \--->venv

&#x20;      \--->requirements.txt

&#x20;      \---> my\_data

### Create the virtual Env.

The folder of the virtual ennvirenment should be a seperated folder which is not containing content from your project by it self. To controll packages a "requirement.txt" file helps to organize it.

This "requirments.txt" file can be shared to other users to make a fast start in the project avaible.

The virtual env folder ( best practise: "venv" ) dont have to be shared

### Two way to use the Venv

First you could create an env as a copy of your actual python version with the packages from the system with <br>

```
 python -m venv venv --system-site-packages 
```

Activate the env with&#x20;

```
source my_project/bin/activate
```

You can now control the complete copy  with&#x20;

```
# get all with activated venv
pip list

# or only the local used packages
pip list --local
```

### Create a package Copy to requirements.txt

```
pip freeze > requirements.txt
```

this command create a copy of the acutal copy of the activated env in a text-file\
@video[ \[ Python Tutorial: VENV (Mac & Linux) - How to Use Virtual Environments with the Built-In venv Module \]](https://www.youtube.com/watch?v=Kg1Yvry_Ydk)


---

# 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://quantum-computing.gitbook.io/introduction-to-quantum-computing/which-tools-do-you-use/python-virtual-env-and-jupyter/how-to-install-virtuel-env-on-ubuntu/python-with-venv.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.
