title: Python: Set PYTHONPATH according to requirements.txt at runtime
body: <p>I have a Python application that comes with a command line script. I expose the script via <code>setuptools</code> "entry point" feature. Whenever a user runs the script, I would like the environment to be consistent with the package's <code>requirements.txt</code>. This means that the environment must contain versions of each dependency package that match the version specifiers in <code>requirements.txt</code>.</p>
  
  <p>I know that this can be achieved with <code>venv</code>/<code>virtualenv</code> by making my users create a virtual environment, install <code>requirements.txt</code> in it, and activate that virtual environment whenever they run the script. I do not want to impose this burden of manually invoking <code>virtualenv</code> on users. Ruby's <code>bundler</code> solves this problem by providing <code>bundler/setup</code>-- when loaded, it modifies Ruby's <code>$LOAD_PATH</code> to reflect the contents of the <code>Gemfile</code> (analogue of <code>requirements.txt</code>). Thus it can be placed at the top of a script to transparently control the runtime environment. Does Python have an equivalent? That is, a way to set the environment at runtime according to <code>requirements.txt</code> without imposing additional complexity on the user?</p>