DEV Community

Timo Reusch
Timo Reusch

Posted on

Create a Python virtual environment (quick)

When working with Python, it’s best practice to use a separate virtual environment for each project to avoid dependency conflicts. Tools like PyCharm create virtual environments automatically, but you can just as easily do it via the command line:

  1. cd to your project root and create a new virtual environment

    Running this command will create a .venv folder (a common name, but you can customize it if needed):

    python3 -m venv .venv
    
  2. Activate the virtual environment

    source .venv/bin/activate
    
  3. Once activated, your console should look like this:

    (.venv) <user>@<computer> <FolderName>
    

You can leave the virtual environment by executing deactivate.

Top comments (0)

Google AI Education track image

Work through these 3 parts to earn the exclusive Google AI Studio Builder badge!

This track will guide you through Google AI Studio's new "Build apps with Gemini" feature, where you can turn a simple text prompt into a fully functional, deployed web application in minutes.

Read more →

Join the Algolia MCP Server Challenge: $3,000 in Prizes!

Explore the intersection of AI and search technology by building with the Algolia’s MCP Server. Three talented winners will be selected to share in our $3,000 prize pool!

Check out the challenge

DEV is bringing live events to the community. Dismiss if you're not interested. ❤️