1.4. Running Multiple Versions of SCons Side-by-Side

In some cases you may need several versions of SCons present on a system at the same time - perhaps you have an older project to build that has not yet been "ported" to a newer SCons version, or maybe you want to test a new SCons release side-by-side with a previous one before switching over. The use of an "uninstalled" package as described in the previous section can be of use for this purpose.

Another approach to multiple versions is to create Python virtualenvs, and install different SCons versions in each. A Python virtual environment is a directory with an isolated set of Python packages, where packages you install/upgrade/remove inside the environment do not affect anything outside it, and those you install/upgrade/remove outside of it do not affect anything inside it. In other words, anything you do with pip in the environment stays in that environment. The Python standard library provides a module called venv for creating these (https://docs.python.org/e/library/venv.html), although there are also other tools which provide more precise control of the setup.

Using a virtualenv can be useful even for a single version of SCons, to gain the advantages of having an isolated environment. It also gets around the problem of not having administrative privileges on a particular system to install a distribution package or use pip to install to a system location, as the virtualenv is completely under your control.

The following outline shows how this could be set up on a Linux/POSIX system (the syntax will be a bit different on Windows):

$ create virtualenv named scons3
$ create virtualenv named scons4
$ source scons3/bin/activate
$ pip install scons==3.1.2
$ deactivate
$ source scons4/bin/activate
$ pip install scons
$ deactivate
$ activate a virtualenv and run 'scons' to use that version