how to install python dependencies, there is a requirements.txt file in the project folder
To install Python dependencies listed in a requirements.txt
file, you can use the pip
package manager, which is included with Python. Follow these steps:
Open a terminal or command prompt:
cmd
or PowerShell
.Navigate to your project directory:
Use the cd
command to change the directory to where your requirements.txt
file is located. For example:
cd path/to/your/project
Create and activate a virtual environment (optional but recommended):
Creating a virtual environment helps to manage dependencies separately for different projects. To create and activate a virtual environment, use the following commands:
On macOS and Linux:
python3 -m venv venv
source venv/bin/activate
On Windows:
python -m venv venv
.\venv\Scripts\activate
Install the dependencies:
Use pip
to install the dependencies specified in requirements.txt
:
pip install -r requirements.txt
This command will read the requirements.txt
file and install all the packages listed, along with their specified versions.
pip list
This will list all the installed packages in the current environment, which should include those specified in your requirements.txt
.
Remember, if you are using a virtual environment, you need to activate it every time you start a new session to work on your project.