pip install requirements into venv

preview_player
Показать описание
A virtual environment is a self-contained directory that contains its own installation of Python and other dependencies. This is useful to isolate project-specific dependencies and avoid conflicts with other projects. In this tutorial, we'll walk through the process of creating a virtual environment and installing project dependencies using pip.
Open a terminal and navigate to your project's directory. To create a virtual environment, run the following command:
This command uses the venv module to create a virtual environment named venv in your project directory. You can replace venv with any name you prefer.
After creating the virtual environment, you need to activate it. On Windows, use:
On Unix or MacOS, use:
You will see the virtual environment's name in your terminal prompt, indicating that you are now working within the virtual environment.
This example includes two dependencies, requests and flask, with specified versions.
You can verify that the dependencies are installed correctly by running:
This will display a list of installed packages in the virtual environment, including the versions.
Once you've finished working in the virtual environment, deactivate it by running:
This returns you to the global Python environment.
ChatGPT
Рекомендации по теме