Reputation: 16275
Is there a way to import a Python library at a certain path? For example,
import os, sys, etc
import "/path/to/lib.py"
I'd like to include a library with a python file, and other than making them install the library, this is the best way I can think of.
Upvotes: 1
Views: 918
Reputation: 55197
You could do:
sys.path.append('/path/to')
import lib
But, to be honest, you shouldn't.
It's pretty easy to install a library, especially using tools such as virtualenv and pip.
Upvotes: 5