Chapter 1. Building and Installing SCons

This chapter will take you through the basic steps of installing SCons on your system, and building SCons if you don't have a pre-built package available (or simply prefer the flexibility of building it yourself). Before that, however, this chapter will also describe the basic steps involved in installing Python on your system, in case that is necessary. Fortunately, both SCons and Python are very easy to install on almost any system, and Python already comes installed on many systems.

1.1. Installing Python

Because SCons is written in Python, you need to have Python installed on your system to use SCons. Before you try to install Python, you should check to see if Python is already available on your system by typing python -V (capital 'V') or python --version at your system's command-line prompt. For Linux/Unix/MacOS/BSD type systems this looks like:

$ python -V
Python 3.7.1
    

In a cmd shell or PowerShell on a Windows system (note PoweShell needs it spelled "python.exe" rather than "python"):

C:\>python -V
Python 3.7.1
    

If Python is not installed on your system, you will see an error message stating something like "command not found" (on UNIX or Linux) or "'python' is not recognized as an internal or external command, operable progam or batch file" (on Windows). In that case, you need to install Python before you can install SCons.

The standard location for information about downloading and installing Python is http://www.python.org/download/. See that page and associated links to get started.

For Linux systems, Python is almost certainly available as a supported package, possibly installed by default; this is often preferred to installing by other means, and is easier than installing from source code. Many such systems have separate packages for Python 2 and Python 3. Building from source may still be a useful option if you need a version that is not offered by the distribution you are using.

SCons will work with Python 2.7.x or with Python 3.5 or later. If you need to install Python and have a choice, we recommend using the most recent Python version available. Newer Pythons have significant improvements that help speed up the performance of SCons.