Create a venv anywhere, not just in the project root.
Section: Create environments
Create in a custom directory
bash
bash
python -m venv ~/venvs/myprojectExplanation
Useful if you prefer to keep environments outside the repository tree.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Create environments
Create a .venv environment
Create a conventional project-local virtual environment.
Create with python3
Use python3 explicitly on systems where python points elsewhere.
Create with Windows py launcher
Create an environment using the Windows Python launcher.
Create with a specific Python version
Use a specific interpreter to choose the base Python version.
Create with system site packages
Allow access to packages installed in the base interpreter.