πCreate the requirements.txt
Last updated
Last updated
It is a simple text file that saves a list of packages needed by your project.
requirements.txt
file?Start by going into your project directory and create a new txt file and make sure it is named requirements.txt
The libraries are not the ones you import into your code, but the ones you install with pip install.
Add the following line to your requirements.txt
When we don't specify a version, pip will always try to install the latest version of the specified package. We can specify versions in the following ways:
discord.py==2.0.0
- Sets a specific version to be installed. Fixing the version in this way ensures that your project will always be working, in case your code is not yet adapted to a higher version
discord.py>=2.0.0
: When we use the>=
sign we are saying that we want to install any higher or equal version of the library.
Add the following line to your requirements.txt
This way we can install Python packages that are available on GitHub but not on PyPI, such as development versions.
If you have Python installed on your computer you can run a simple command in your Terminal to put all the libraries and their versions in a requirements.txt
Make sure you have all the packages your project requires installed on your computer before running
Open the Terminal in your project's directory (Windows use: Shift+Right Button and click Open PowerShell) and run:
--user - Only output packages installed in user-site
You need python and pip installed on your computer, if not, follow the instructions below.