requirements.txt Generator – From Python Imports
NOUVEAUrequirements.txt generator: paste Python code and get the PyPI packages it imports, with cv2→opencv-python style renames, stdlib filtered and optional version pins.
Fonctionne à 100 % dans votre navigateur — vos données ne sont jamais envoyées ni stockées sur nos serveurs.
Cet outil n'est pas encore entièrement traduit : une partie du texte est encore en anglais. L'outil lui-même fonctionne de la même façon dans toutes les langues.
requirements.txt (8 packages)
beautifulsoup4 numpy opencv-python pandas Pillow python-dotenv PyYAML scikit-learn
| Import | Type | Package | Note |
|---|---|---|---|
| os | stdlib | — | standard library |
| json | stdlib | — | standard library |
| numpy | PyPI | numpy | known package |
| pandas | PyPI | pandas | known package |
| cv2 | renamed | opencv-python | import cv2 |
| PIL | renamed | Pillow | import PIL |
| sklearn.model_selection | renamed | scikit-learn | import sklearn |
| yaml | renamed | PyYAML | import yaml |
| bs4 | renamed | beautifulsoup4 | import bs4 |
| dotenv | renamed | python-dotenv | import dotenv |
Standard library list: Python 3.12. Names are matched by a built-in table, not by querying PyPI — check unknown names before installing.
Exemples rapides
Des entrées typiques et les résultats produits par cet outil.
Présentation
This requirements.txt generator reads the import statements in your Python code and turns them into a list of PyPI packages you can install with pip install -r requirements.txt. It knows that many packages are imported under a different name than they are installed with: cv2 comes from opencv-python, PIL from Pillow, sklearn from scikit-learn, yaml from PyYAML, bs4 from beautifulsoup4, dotenv from python-dotenv and a few hundred more, including namespace packages such as google.cloud.storage.
Modules from the Python 3.12 standard library are filtered out, relative imports (from . import x) are ignored, and you can list your own package names to skip. Modules removed in 3.12, like distutils, are flagged with a replacement. Paste version pins such as requests==2.32.3 to apply them to the output, then copy or download the file.
The lookup uses a built-in table and runs entirely in your browser; your code is not uploaded and PyPI is not queried.
Pourquoi utiliser cet outil ?
- Fixes the classic cv2 vs opencv-python mistake
- Python 3.12 standard library filtered automatically
- Keeps your own modules out of the file
- Applies your version pins in one step
- Download a ready requirements.txt
Fonctionnalités
Import-to-PyPI map
Hundreds of import names mapped to their real distribution names, including google.* and azure.* namespaces.
Stdlib aware
The full Python 3.12 standard library module list is excluded, and removed modules are flagged.
Real import parsing
Handles import a, b as c, from x.y import z, try/except imports, semicolons and importlib.import_module("x").
Version pins
Paste ==, >=, ~= or != pins and they replace the bare package names.
Import table
Every import is listed as renamed, PyPI, stdlib, removed or local with a note.
Copy or download
Get a sorted requirements.txt, optionally commented with the import it came from.
Mode d'emploi
Paste your code
Paste a script, a module or just its import lines into the code box.
Skip local modules
List your own package names under Your own modules to skip.
Add pins if needed
Type version pins, one per line, to lock versions.
Copy or download
Press Copy or Download to save requirements.txt.