Python Install Dependency Libraries Into Local Directory

Dec 22, 2018

Create requirements.txt to list of depedency libraries.

# Check latest version:

Install virtualenv.

sudo -H pip install virtualenv

Create a virtualenv named env and activate it.

virtualenv envsource env/bin/activate

Install dependencies into lib directory.

pip install -t lib -r requirements.txt

Deactivate env.


Python files to include the lib directory.

import syssys.path.append('lib')from flask import Flask

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.