-
Install pipenv
pip install pipenv
-
Create virtual environment
pipenv --python 3.11
-
Activate virtual environment
pipenv shell
-
Install Python package in virtual environment
- pip install {package1} {package2} ...
pip install requests bs4
Packages does not be maintained in Pipfile
-
Maintain packages in Pipfile
- pipenv install {package1} {package2} ...
pipenv install requests bs4
This also output a lock file
-
Deactivate virtual environment
deactivate
-
Output lock file
pipenv lock
-
Output requirements.txt, which is used by pip
pipenv requirements > requirements.txt
-
Install packages via requirements.txt
pip install -r requirements.txt