diff --git a/pipenv/patched/pip/__main__.py b/pipenv/patched/pip/__main__.py index b424ab20..79d52838 100644 --- a/pipenv/patched/pip/__main__.py +++ b/pipenv/patched/pip/__main__.py @@ -28,6 +28,13 @@ if __name__ == "__main__": ) import importlib.util import sys + + + SITE_PACKAGES_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) + + # Inject site directory into system path. + sys.path.insert(-1, SITE_PACKAGES_ROOT) + spec = importlib.util.spec_from_file_location( "pipenv", location=os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "__init__.py")) pipenv = importlib.util.module_from_spec(spec) diff --git a/pipenv/resolver.py b/pipenv/resolver.py index 3fea0a1e..a0d9da29 100644 --- a/pipenv/resolver.py +++ b/pipenv/resolver.py @@ -6,6 +6,11 @@ import sys os.environ["PIP_PYTHON_PATH"] = str(sys.executable) +SITE_PACKAGES_ROOT = os.path.dirname(os.path.dirname(__file__)) + +# Inject site directory into system path. +sys.path.insert(-1, SITE_PACKAGES_ROOT) + def _ensure_modules(): spec = importlib.util.spec_from_file_location(