python automatically generates the requirements file for the current project
there are several ways:
1. Use PIP freeze
< pre style=”margin: 0px 0px 15px; padding: 0px; font-family: “Courier New” ! important; font-size: 12px ! important; The line – height: 1.72222; color: inherit; white-space: pre; border-radius: 6px; overflow-wrap: break-word;” > pip freeze > requirements.txt< /pre>
this way is to list the packages in the entire environment, if it is a virtual environment. In general, we only need to export the current project’s requirement.txt, and pipreqs
is recommended2. Use pipreqs
is a helpful tool that scans the project directory to automatically discover which libraries are used, automatically generates dependency listings, and only generates project-related dependencies to requirements. TXT
p>
installation
< pre style=”margin: 0px 0px 15px; padding: 0px; font-family: “Courier New” ! important; font-size: 12px ! important; The line – height: 1.72222; color: inherit; white-space: pre; border-radius: 6px; overflow-wrap: break-word;” > pip install pipreqs< /pre>
Use
p>
also easy to use pipreqs pathname
here goes directly to the project root directory, so it is./
error
File "c:\users\devtao\appdata\local\programs\python\python36-32\lib\site-packages\pipreqs\pipreqs.py", line 341, in init
extra_ignore_dirs=extra_ignore_dirs)
File "c:\users\devtao\appdata\local\programs\python\python36-32\lib\site-packages\pipreqs\pipreqs.py", line 75, in get_all_imports
contents = f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 186: illegal multibyte sequence
UnicodeDecodeError: ‘GBK’ codec can’t decode byte 0xa6 in position 186: illegal multibyte sequence
directly modify line 407 of pipreqs.py, change encoding to utf-8, save, and run on pipreqs./
pipreqs.py path
C:\Users\linxiao\AppData\Local\Programs\Python\Python37\Lib\site-packages\pipreqs
>条
div>
Read More:
- Python recursively traverses all files in the directory to find the specified file
- Python traverses all files under the specified path and retrieves them according to the time interval
- The Python DOM method iterates over all the XML in a folder
- Python classes that connect to the database
- Change the Python installation path in Pycharm
- Python: How to Reshape the data in Pandas DataFrame
- You can run the Ansible Playbook in Python by hand
- Python+ Pandas + Evaluation of Music Equipment over the years (Notes)
- An error is reported in the requirements code of the generated project
- Python algorithm for “anagram” judgment problem
- [Solved] python tqdm raise RuntimeError(“cannot join current thread“) RuntimeError: cannot join current thr
- Python: How to parses HTML, extracts data, and generates word documents
- [Solved] ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE
- [Solved] Python project runs the open() function error: FileNotFoundError: [Errno 2] No such file or directory
- [Solved] Python Project Error: django.core.exceptions.ImproperlyConfigured: WSGI application ‘WebTool.wsgi.application
- [Solved] Python Read bam File Error: &&OSError: no BGZF EOF marker; file may be truncated
- Chromdriver Install error: File “C:\python37\lib\site-packages\selenium\webdriver\common\service.py”, line 76, in start stdin=PIPE) File…
- Python exports the gitlab project
- [Solved] Python Project Import Module Error: ModuleNotFoundError
- [Solved] Python Error: An attempt has been made to start a new process before the current process has finished …