how to create a virtual env code example

Example 1: create a venv

# Create the virtual environment.
python -m venv venv

# Activate the env.
venv\Scripts\activate.bat

Example 2: how to make a virtual environment in python

.\env\Scripts\activate

Example 3: activate venv in python

(tutorial-env) $ pip search astronomy
skyfield               - Elegant astronomy for Python
gary                   - Galactic astronomy and gravitational dynamics.
novas                  - The United States Naval Observatory NOVAS astronomy library
astroobs               - Provides astronomy ephemeris to plan telescope observations
PyAstronomy            - A collection of astronomy related tools for Python.
...

Example 4: virtual environment python

source env/bin/activate