flask activ environment

To set up a Flask virtual environment, you can follow these steps:

  1. Install Python: Flask is a Python framework, so you need to have Python installed on your system. You can download the latest version of Python from the official Python website and follow the installation instructions specific to your operating system.

  2. Set up a project directory: Create a new directory where you want to store your Flask project. This directory will contain all the necessary files and folders for your Flask application.

  3. Create a virtual environment: A virtual environment is a self-contained Python environment that allows you to isolate your project's dependencies from the system-wide Python installation. Open your command line or terminal, navigate to your project directory, and run the following command to create a virtual environment:

python -m venv env

This command will create a new folder named "env" in your project directory, which will contain the virtual environment.

  1. Activate the virtual environment: To activate the virtual environment, run the appropriate command based on your operating system:

  2. For Windows:

  • For macOS/Linux:
source env/bin/activate

After running this command, your command line prompt should change, indicating that you are now working within the virtual environment.

  1. Install Flask: With the virtual environment activated, you can now install Flask. Run the following command to install Flask using pip, the package installer for Python:
pip install flask

This command will download and install Flask and its dependencies into your virtual environment.

  1. Create a Flask application: Now that Flask is installed, you can start creating your Flask application. Create a new Python file in your project directory, e.g., "app.py", and write your Flask code in this file.

  2. Run the Flask application: To run your Flask application, use the following command:

flask run

This command will start the Flask development server, and your application will be accessible at a local address (e.g.,

Remember to deactivate the virtual environment when you're done working on your Flask project. You can do this by running the following command:


These steps should help you set up a Flask virtual environment and start developing your Flask application.