import pip
import site


def install_package(package):
    """Install a pip package to the user's site-packages directory."""
    exitval = pip.main(['install', '--user', package])
    if exitval == 0:
        # Reload sys.path to make sure the user's site-packages are in sys.path
        site.main()
    return exitval == 0