From f75a2159c726d2a96258a18235c3986da1aa71a3 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 22 Oct 2023 02:28:31 +0200 Subject: [PATCH] [platyvenv] Add the venv bin directory to the PATH. After creating the virtual environment, we should add `/bin` to the `PATH` variable, so any next `python`/`pip` commands will be executed in the new environment. --- platypush/platyvenv/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platypush/platyvenv/__init__.py b/platypush/platyvenv/__init__.py index 84d88879..57bb7866 100755 --- a/platypush/platyvenv/__init__.py +++ b/platypush/platyvenv/__init__.py @@ -133,6 +133,9 @@ class VenvBuilder(BaseBuilder): logger.info('Installing base Python dependencies under %s...', self.output) subprocess.call([*self._pip_cmd, 'pip', '.']) + # Add /bin to the PATH + os.environ['PATH'] = os.path.join(self.output, 'bin') + ':' + os.environ['PATH'] + def _install_extra_pip_packages(self, deps: Dependencies): """ Install the extra pip dependencies inferred from the configured