Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- python3 -m venv venv source venv/bin/activate
- venv is a module in Python used for creating virtual environments. A virtual environment is an isolated space where Python projects can have their own dependencies, preventing conflicts between different projects. It allows you to manage packages for specific projects without affecting the global Python installation or other projects.
- To create a virtual environment, you can use the following command in your terminal:
- Code
- python -m venv <environment_name>
- Replace <environment_name> with the desired name for your virtual environment (e.g., .venv, myenv). This command creates a directory containing the necessary files for the virtual environment.
- To activate the virtual environment, use one of the following commands, depending on your operating system: On Windows.
- Code
- <environment_name>\Scripts\activate
- On macOS and Linux.
- Code
- source <environment_name>/bin/activate
- Once activated, the environment name will appear in parentheses or brackets at the beginning of your terminal prompt, indicating that you are working within the virtual environment.
- To deactivate the virtual environment, simply type deactivate in the terminal.
- Code
- deactivate
- When the virtual environment is deactivated, you will revert back to the global Python environment.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement