Installing Python Dependencies locally in project

henhen picture henhen · Dec 25, 2018 · Viewed 10.8k times · Source

I am coming from NodeJS and learning Python and was wondering how to properly install the packages in requirements.txt file locally in the project.

For node, this is done by managing and installing the packages in package.json via npm install. However, the convention for Python project seems to be to add packages to a directory called lib. When I do pip install -r requirements.txt I think this does a global install on my computer, similar to nodes npm install -g global install. How can I install the dependencies of my requirements.txt file in a folder called lib?

Answer

sahasrara62 picture sahasrara62 · Dec 25, 2018

use this command
pip install -r requirements.txt -t <path-to-the-lib-directory>