Python: Import Python Packages in Other Directory

In this tutorial, we will introduce how to import python packages that are in other directory.

Python: Import Python Packages in Other Directory

For example:

If python packages you plan to import in the direcory: c:\libs, You can import these packages as follows:

import sys

sys.path.append("c:/libs")

In this code, we use code:

sys.path.append("c:/libs")

It will tell python script to find packages in c:\libs. Then you can import libraries successfully.