it is a hard to install all the libraries one by one. Each time you have to find out the name of the library and install it one by one. But if we know libraries like pipreqs which automatically installs all the required libraries to run the program
What is Pipreqs?
It is a python library that Generates pip requirements.txt file based on imports of any project and then you can install all of them in one go.
Join Our Discord Hacking Server: https://discord.gg/ZChEmMwE8d
Invite Our Cybersec Bot: https://dsc.gg/spyo
Step 1: Go to the directory in which your python script is present for example assume if we take this code in our directory. Let’s assume that your Python script is example.py
:
import os
import time
import sys
import fnmatch
import requests
import urllib.request
from bs4 import BeautifulSoup
from multiprocessing.dummy import Pool as ThreadPool
print('test')
You can use pipreqs to automatically generate a requirements.txt
file based on the import
statements that the Python script(s) contain. To use pipreqs
, assuming that you are in the directory where example.py
is located:
Installing Pipreqs:
Run this command on your PC to install the pipreqs library.
pip install pipreqs
pipreqs
It will generate the following requirements.txt
file. The requirement file will look like this in our case.
requests==2.23.0
beautifulsoup4==4.9.1
which you can install with:
pip install -r requirements.txt
Other useful command…
Use pip list to get a full list installed python packages.