requirements.txt file for installing python packages
You can use a requirements.txt
file to install multiple Python packages at once.
1. Create a requirements.txt
file
This file should list all the packages you want to install, with each package on a new line. Example:
==
specifies an exact version.>=
installs a minimum version.<=
installs up to a certain version.
2. Install packages using requirements.txt
Run the following command in your terminal or command prompt:
This will install all the packages listed in the file.
3. Generate a requirements.txt
file (Optional)
If you already have packages installed in your environment and want to create a requirements.txt
file, run:
This will generate a list of installed packages with their versions. Please note that output may be a dump of all packages in the environment that may not be very useful.
Creating and using virtual environment in python
Using minoconda:
There is a detailed post here, for quick reference here is the command to be used:
conda create --name myenv python=3.9 conda activate myenv
mentioning python and its version is not mandatory if you want to use a common python
Comments
Post a Comment